|
1 | 1 | <?php |
2 | | -class ReaderTest extends \PHPUnit_Framework_TestCase |
| 2 | +class NativeTest extends \PHPUnit_Framework_TestCase |
3 | 3 | { |
4 | 4 | /** |
5 | | - * @var \PHPExif\Reader |
| 5 | + * @var \PHPExif\Reader\Adapter\Native |
6 | 6 | */ |
7 | | - protected $reader; |
| 7 | + protected $adapter; |
8 | 8 |
|
9 | 9 | public function setUp() |
10 | 10 | { |
11 | | - $this->reader = new \PHPExif\Reader(); |
| 11 | + $this->adapter = new \PHPExif\Reader\Adapter\Native(); |
12 | 12 | } |
13 | 13 |
|
14 | 14 | public function testSetIncludeThumbnail() |
15 | 15 | { |
16 | | - $reflProperty = new \ReflectionProperty('\PHPExif\Reader', 'includeThumbnail'); |
| 16 | + $reflProperty = new \ReflectionProperty('\PHPExif\Reader\Adapter\Native', 'includeThumbnail'); |
17 | 17 | $reflProperty->setAccessible(true); |
18 | 18 |
|
19 | | - $this->assertEquals(\PHPExif\Reader::NO_THUMBNAIL, $reflProperty->getValue($this->reader)); |
| 19 | + $this->assertEquals(\PHPExif\Reader\Adapter\Native::NO_THUMBNAIL, $reflProperty->getValue($this->adapter)); |
20 | 20 |
|
21 | | - $this->reader->setIncludeThumbnail(\PHPExif\Reader::INCLUDE_THUMBNAIL); |
| 21 | + $this->adapter->setIncludeThumbnail(\PHPExif\Reader\Adapter\Native::INCLUDE_THUMBNAIL); |
22 | 22 |
|
23 | | - $this->assertEquals(\PHPExif\Reader::INCLUDE_THUMBNAIL, $reflProperty->getValue($this->reader)); |
| 23 | + $this->assertEquals(\PHPExif\Reader\Adapter\Native::INCLUDE_THUMBNAIL, $reflProperty->getValue($this->adapter)); |
24 | 24 | } |
25 | 25 |
|
26 | 26 | public function testGetRequiredSections() |
27 | 27 | { |
28 | | - $reflProperty = new \ReflectionProperty('\PHPExif\Reader', 'sections'); |
| 28 | + $reflProperty = new \ReflectionProperty('\PHPExif\Reader\Adapter\Native', 'sections'); |
29 | 29 | $reflProperty->setAccessible(true); |
30 | 30 |
|
31 | | - $this->assertEquals($reflProperty->getValue($this->reader), $this->reader->getRequiredSections()); |
| 31 | + $this->assertEquals($reflProperty->getValue($this->adapter), $this->adapter->getRequiredSections()); |
32 | 32 | } |
33 | 33 |
|
34 | 34 | public function testSetRequiredSections() |
35 | 35 | { |
36 | | - $reflProperty = new \ReflectionProperty('\PHPExif\Reader', 'sections'); |
| 36 | + $reflProperty = new \ReflectionProperty('\PHPExif\Reader\Adapter\Native', 'sections'); |
37 | 37 | $reflProperty->setAccessible(true); |
38 | 38 |
|
39 | 39 | $testData = array('foo', 'bar', 'baz'); |
40 | 40 |
|
41 | | - $returnValue = $this->reader->setRequiredSections($testData); |
| 41 | + $returnValue = $this->adapter->setRequiredSections($testData); |
42 | 42 |
|
43 | | - $this->assertEquals($testData, $reflProperty->getValue($this->reader)); |
44 | | - $this->assertEquals($this->reader, $returnValue); |
| 43 | + $this->assertEquals($testData, $reflProperty->getValue($this->adapter)); |
| 44 | + $this->assertEquals($this->adapter, $returnValue); |
45 | 45 | } |
46 | 46 |
|
47 | 47 | public function testAddRequiredSection() |
48 | 48 | { |
49 | | - $reflProperty = new \ReflectionProperty('\PHPExif\Reader', 'sections'); |
| 49 | + $reflProperty = new \ReflectionProperty('\PHPExif\Reader\Adapter\Native', 'sections'); |
50 | 50 | $reflProperty->setAccessible(true); |
51 | 51 |
|
52 | 52 | $testData = array('foo', 'bar', 'baz'); |
53 | | - $this->reader->setRequiredSections($testData); |
| 53 | + $this->adapter->setRequiredSections($testData); |
54 | 54 |
|
55 | | - $returnValue = $this->reader->addRequiredSection('test'); |
| 55 | + $returnValue = $this->adapter->addRequiredSection('test'); |
56 | 56 | array_push($testData, 'test'); |
57 | 57 |
|
58 | | - $this->assertEquals($testData, $reflProperty->getValue($this->reader)); |
59 | | - $this->assertEquals($this->reader, $returnValue); |
| 58 | + $this->assertEquals($testData, $reflProperty->getValue($this->adapter)); |
| 59 | + $this->assertEquals($this->adapter, $returnValue); |
60 | 60 | } |
61 | 61 |
|
62 | 62 | public function testGetExifFromFileNoData() |
63 | 63 | { |
64 | 64 | $file = PHPEXIF_TEST_ROOT . '/files/empty.jpg'; |
65 | 65 | $this->setExpectedException('RuntimeException'); |
66 | | - $result = $this->reader->getExifFromFile($file); |
| 66 | + $result = $this->adapter->getExifFromFile($file); |
67 | 67 | } |
68 | 68 |
|
69 | 69 | public function testGetExifFromFileHasData() |
70 | 70 | { |
71 | | - $file = PHPEXIF_TEST_ROOT . '/files/morning_glory_pool.jpg'; |
72 | | - $result = $this->reader->getExifFromFile($file); |
| 71 | + $file = PHPEXIF_TEST_ROOT . '/files/morning_glory_pool_500.jpg'; |
| 72 | + $result = $this->adapter->getExifFromFile($file); |
73 | 73 | $this->assertInstanceOf('\PHPExif\Exif', $result); |
74 | 74 | } |
75 | 75 |
|
76 | 76 | public function testGetIptcData() |
77 | 77 | { |
78 | | - $file = PHPEXIF_TEST_ROOT . '/files/morning_glory_pool_smaller.jpg'; |
79 | | - $result = $this->reader->getIptcData($file); |
| 78 | + $file = PHPEXIF_TEST_ROOT . '/files/morning_glory_pool_500.jpg'; |
| 79 | + $result = $this->adapter->getIptcData($file); |
80 | 80 | $expected = array( |
81 | 81 | 'title' => 'Morning Glory Pool', |
82 | 82 | 'keywords' => array( |
|
0 commit comments