|
1 | 1 | <?php |
2 | 2 |
|
3 | | -namespace League\Glide\Responses; |
| 3 | +namespace Responses; |
4 | 4 |
|
| 5 | +use League\Glide\Responses\SymfonyResponseFactory; |
5 | 6 | use Mockery; |
| 7 | +use PHPUnit\Framework\TestCase; |
6 | 8 |
|
7 | | -class SymfonyResponseFactoryTest extends \PHPUnit_Framework_TestCase |
| 9 | +class SymfonyResponseFactoryTest extends TestCase |
8 | 10 | { |
9 | | - public function tearDown() |
| 11 | + public function tearDown(): void |
10 | 12 | { |
11 | 13 | Mockery::close(); |
12 | 14 | } |
13 | 15 |
|
14 | | - public function testCreateInstance() |
| 16 | + public function testCreateInstance(): void |
15 | 17 | { |
16 | | - $this->assertInstanceOf( |
| 18 | + self::assertInstanceOf( |
17 | 19 | 'League\Glide\Responses\SymfonyResponseFactory', |
18 | 20 | new SymfonyResponseFactory() |
19 | 21 | ); |
20 | 22 | } |
21 | 23 |
|
22 | | - public function testCreate() |
| 24 | + public function testCreate(): void |
23 | 25 | { |
24 | | - $this->cache = Mockery::mock('League\Flysystem\FilesystemInterface', function ($mock) { |
25 | | - $mock->shouldReceive('getMimetype')->andReturn('image/jpeg')->once(); |
26 | | - $mock->shouldReceive('getSize')->andReturn(0)->once(); |
| 26 | + $cache = Mockery::mock('League\Flysystem\FilesystemOperator', function ($mock) { |
| 27 | + $mock->shouldReceive('mimeType')->andReturn('image/jpeg')->once(); |
| 28 | + $mock->shouldReceive('fileSize')->andReturn(0)->once(); |
27 | 29 | $mock->shouldReceive('readStream'); |
28 | 30 | }); |
29 | 31 |
|
30 | 32 | $factory = new SymfonyResponseFactory(); |
31 | | - $response = $factory->create($this->cache, ''); |
| 33 | + $response = $factory->create($cache, ''); |
32 | 34 |
|
33 | | - $this->assertInstanceOf('Symfony\Component\HttpFoundation\StreamedResponse', $response); |
34 | | - $this->assertEquals('image/jpeg', $response->headers->get('Content-Type')); |
35 | | - $this->assertEquals('0', $response->headers->get('Content-Length')); |
36 | | - $this->assertContains(gmdate('D, d M Y H:i', strtotime('+1 years')), $response->headers->get('Expires')); |
37 | | - $this->assertEquals('max-age=31536000, public', $response->headers->get('Cache-Control')); |
| 35 | + self::assertInstanceOf('Symfony\Component\HttpFoundation\StreamedResponse', $response); |
| 36 | + self::assertEquals('image/jpeg', $response->headers->get('Content-Type')); |
| 37 | + self::assertEquals('0', $response->headers->get('Content-Length')); |
| 38 | + self::assertStringContainsString(gmdate('D, d M Y H:i', strtotime('+1 years')), $response->headers->get('Expires')); |
| 39 | + self::assertEquals('max-age=31536000, public', $response->headers->get('Cache-Control')); |
38 | 40 | } |
39 | 41 | } |
0 commit comments