Add test to cover
This commit is contained in:
parent
7021ef49b4
commit
5d8814e900
|
|
@ -20,7 +20,6 @@ class PackageManagerTest extends TestCase
|
||||||
public function testDownload()
|
public function testDownload()
|
||||||
{
|
{
|
||||||
$mock = new MockHandler([
|
$mock = new MockHandler([
|
||||||
new Response(200, [], 'contents'),
|
|
||||||
new Response(200, [], 'contents'),
|
new Response(200, [], 'contents'),
|
||||||
new RequestException('error', new Request('GET', 'url')),
|
new RequestException('error', new Request('GET', 'url')),
|
||||||
]);
|
]);
|
||||||
|
|
@ -34,13 +33,22 @@ class PackageManagerTest extends TestCase
|
||||||
$package->download('url', storage_path('packages/temp'))
|
$package->download('url', storage_path('packages/temp'))
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->expectException(Exception::class);
|
$this->expectExceptionMessage(trans('admin.download.errors.download', ['error' => 'error']));
|
||||||
$package->download('url', storage_path('packages/temp'), 'deadbeef');
|
|
||||||
|
|
||||||
$this->expectException(Exception::class);
|
|
||||||
$package->download('url', storage_path('packages/temp'));
|
$package->download('url', storage_path('packages/temp'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testShasumCheck()
|
||||||
|
{
|
||||||
|
$mock = new MockHandler([new Response(200, [], 'contents')]);
|
||||||
|
$handler = HandlerStack::create($mock);
|
||||||
|
$client = new Client(['handler' => $handler]);
|
||||||
|
$this->instance(Client::class, $client);
|
||||||
|
|
||||||
|
$package = resolve(PackageManager::class);
|
||||||
|
$this->expectExceptionMessage(trans('admin.download.errors.shasum'));
|
||||||
|
$package->download('url', storage_path('packages/temp'), 'deadbeef');
|
||||||
|
}
|
||||||
|
|
||||||
public function testExtract()
|
public function testExtract()
|
||||||
{
|
{
|
||||||
$this->mock(ZipArchive::class, function ($mock) {
|
$this->mock(ZipArchive::class, function ($mock) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user