|
8 | 8 | #[CoversClass(Exif::class)]
|
9 | 9 | class ExifTest extends TestCase
|
10 | 10 | {
|
| 11 | + protected function _image($filename = 'image/cat.jpg') |
| 12 | + { |
| 13 | + return new Image(static::FIXTURES . '/' . $filename); |
| 14 | + } |
| 15 | + |
11 | 16 | protected function _exif($filename = 'image/cat.jpg')
|
12 | 17 | {
|
13 |
| - $image = new Image(static::FIXTURES . '/' . $filename); |
| 18 | + $image = $this->_image($filename); |
14 | 19 | return new Exif($image);
|
15 | 20 | }
|
16 | 21 |
|
@@ -70,6 +75,38 @@ public function testAperture(): void
|
70 | 75 | }
|
71 | 76 |
|
72 | 77 | public function testIso(): void
|
| 78 | + { |
| 79 | + $image = $this->_image(); |
| 80 | + $exif = new class ($image) extends Exif { |
| 81 | + public static function read(string $root): array |
| 82 | + { |
| 83 | + return [ |
| 84 | + ...parent::read($root), |
| 85 | + 'ISOSpeedRatings' => 100 |
| 86 | + ]; |
| 87 | + } |
| 88 | + }; |
| 89 | + |
| 90 | + $this->assertSame('100', $exif->iso()); |
| 91 | + } |
| 92 | + |
| 93 | + public function testIsoWithArrayValue(): void |
| 94 | + { |
| 95 | + $image = $this->_image(); |
| 96 | + $exif = new class ($image) extends Exif { |
| 97 | + public static function read(string $root): array |
| 98 | + { |
| 99 | + return [ |
| 100 | + ...parent::read($root), |
| 101 | + 'ISOSpeedRatings' => [100, 200] |
| 102 | + ]; |
| 103 | + } |
| 104 | + }; |
| 105 | + |
| 106 | + $this->assertSame('100', $exif->iso()); |
| 107 | + } |
| 108 | + |
| 109 | + public function testIsoWithoutValue(): void |
73 | 110 | {
|
74 | 111 | $exif = $this->_exif();
|
75 | 112 | $this->assertNull($exif->iso());
|
|
0 commit comments