44 * @copyright Copyright (C) Ibexa AS. All rights reserved.
55 * @license For full copyright and license information view LICENSE file distributed with this source code.
66 */
7+ declare (strict_types=1 );
78
89namespace Ibexa \Tests \Bundle \Core \Imagine ;
910
1516use Ibexa \Core \IO \Values \MissingBinaryFile ;
1617use Liip \ImagineBundle \Exception \Binary \Loader \NotLoadableException ;
1718use Liip \ImagineBundle \Model \Binary ;
19+ use PHPUnit \Framework \MockObject \MockObject ;
1820use PHPUnit \Framework \TestCase ;
1921use Symfony \Component \Mime \MimeTypes ;
2022
21- class BinaryLoaderTest extends TestCase
23+ /**
24+ * @covers \Ibexa\Bundle\Core\Imagine\BinaryLoader
25+ */
26+ final class BinaryLoaderTest extends TestCase
2227{
23- /** @var \PHPUnit\Framework\MockObject\MockObject */
24- private $ ioService ;
28+ private IOServiceInterface & MockObject $ ioService ;
2529
26- /** @var \Ibexa\Bundle\Core\Imagine\BinaryLoader */
27- private $ binaryLoader ;
30+ private BinaryLoader $ binaryLoader ;
2831
2932 protected function setUp (): void
3033 {
@@ -33,35 +36,34 @@ protected function setUp(): void
3336 $ this ->binaryLoader = new BinaryLoader ($ this ->ioService , new MimeTypes ());
3437 }
3538
36- public function testFindNotFound ()
39+ public function testFindNotFound (): void
3740 {
38- $ this ->expectException (\Liip \ImagineBundle \Exception \Binary \Loader \NotLoadableException::class);
39-
4041 $ path = 'something.jpg ' ;
4142 $ this ->ioService
4243 ->expects (self ::once ())
4344 ->method ('loadBinaryFile ' )
4445 ->with ($ path )
4546 ->will (self ::throwException (new NotFoundException ('foo ' , 'bar ' )));
4647
48+ $ this ->expectException (NotLoadableException::class);
4749 $ this ->binaryLoader ->find ($ path );
4850 }
4951
50- public function testFindMissing ()
52+ public function testFindMissing (): void
5153 {
52- $ this ->expectException (\ Liip \ ImagineBundle \ Exception \ Binary \ Loader \ NotLoadableException::class);
54+ $ this ->expectException (NotLoadableException::class);
5355
5456 $ path = 'something.jpg ' ;
5557 $ this ->ioService
5658 ->expects (self ::once ())
5759 ->method ('loadBinaryFile ' )
5860 ->with ($ path )
59- ->will ( self :: returnValue ( new MissingBinaryFile () ));
61+ ->willReturn ( new MissingBinaryFile ());
6062
6163 $ this ->binaryLoader ->find ($ path );
6264 }
6365
64- public function testFindBadPathRoot ()
66+ public function testFindBadPathRoot (): void
6567 {
6668 $ path = 'var/site/storage/images/1/2/3/123-name/name.png ' ;
6769 $ this ->ioService
0 commit comments