1
0
mirror of https://github.com/flarum/core.git synced 2025-08-11 19:04:29 +02:00

Auto append :* when installing an extension if not specifying a version

This commit is contained in:
SychO9
2021-11-09 20:06:03 +01:00
parent 594bbe4f34
commit 7f5f5687db
3 changed files with 53 additions and 4 deletions

View File

@@ -63,6 +63,26 @@ class RequireExtensionTest extends TestCase
$this->assertExtensionExists('v17development-blog');
}
/**
* @test
*/
public function requiring_a_compatible_extension_with_specific_version_works()
{
$response = $this->send(
$this->request('POST', '/api/package-manager/extensions', [
'authenticatedAs' => 1,
'json' => [
'data' => [
'package' => 'v17development/flarum-blog:0.4.0'
]
]
])
);
$this->assertEquals(200, $response->getStatusCode());
$this->assertExtensionExists('v17development-blog');
}
/**
* @test
*/
@@ -82,4 +102,24 @@ class RequireExtensionTest extends TestCase
$this->assertEquals(409, $response->getStatusCode());
$this->assertEquals('extension_incompatible_with_instance', $this->guessedCause($response));
}
/**
* @test
*/
public function requiring_an_uncompatible_extension_with_specific_version_fails()
{
$response = $this->send(
$this->request('POST', '/api/package-manager/extensions', [
'authenticatedAs' => 1,
'json' => [
'data' => [
'package' => 'flarum/auth-github:0.1.0-beta.9'
]
]
])
);
$this->assertEquals(409, $response->getStatusCode());
$this->assertEquals('extension_incompatible_with_instance', $this->guessedCause($response));
}
}