diff --git a/tests/ServicesTest/PackageManagerTest.php b/tests/ServicesTest/PackageManagerTest.php index 6fc4ace4..ae44ce26 100644 --- a/tests/ServicesTest/PackageManagerTest.php +++ b/tests/ServicesTest/PackageManagerTest.php @@ -20,7 +20,6 @@ class PackageManagerTest extends TestCase public function testDownload() { $mock = new MockHandler([ - new Response(200, [], 'contents'), new Response(200, [], 'contents'), new RequestException('error', new Request('GET', 'url')), ]); @@ -34,13 +33,22 @@ class PackageManagerTest extends TestCase $package->download('url', storage_path('packages/temp')) ); - $this->expectException(Exception::class); - $package->download('url', storage_path('packages/temp'), 'deadbeef'); - - $this->expectException(Exception::class); + $this->expectExceptionMessage(trans('admin.download.errors.download', ['error' => 'error'])); $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() { $this->mock(ZipArchive::class, function ($mock) {