Skip to content

Commit 1bb211e

Browse files
author
Tom Van Herreweghe
committed
Test if constructor calls setData
Signed-off-by: Tom Van Herreweghe <tom@king-foo.be>
1 parent ee4d7d2 commit 1bb211e

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

tests/PHPExif/ExifTest.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,31 @@ public function setUp()
1515
$this->exif = new \PHPExif\Exif();
1616
}
1717

18+
/**
19+
* @group exif
20+
*/
21+
public function testConstructorCallsSetData()
22+
{
23+
$input = array();
24+
25+
// Get mock, without the constructor being called
26+
$mock = $this->getMockBuilder('\\PHPExif\\Exif')
27+
->disableOriginalConstructor()
28+
->getMock();
29+
30+
// set expectations for constructor calls
31+
$mock->expects($this->once())
32+
->method('setData')
33+
->with(
34+
$this->equalTo($input)
35+
);
36+
37+
// now call the constructor
38+
$reflectedClass = new ReflectionClass('\\PHPExif\\Exif');
39+
$constructor = $reflectedClass->getConstructor();
40+
$constructor->invoke($mock, $input);
41+
}
42+
1843
/**
1944
* @group exif
2045
*/

0 commit comments

Comments
 (0)