Skip to content

Commit 02259e3

Browse files
Update project tests to be PHP 7.2 compatible
1 parent fb12deb commit 02259e3

File tree

2 files changed

+14
-13
lines changed

2 files changed

+14
-13
lines changed

tests/PHPExif/Hydrator/MutatorTest.php

+6-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ public function testHydrateCallsDetermineMutator()
2424
);
2525

2626
// create mock
27-
$mock = $this->getMock('\\PHPExif\\Hydrator\\Mutator', array('determineMutator'));
27+
$mock = $this->getMockBuilder('\\PHPExif\\Hydrator\\Mutator')
28+
->setMethods(array('determineMutator'))
29+
->getMock();
2830

2931
$mock->expects($this->exactly(count($input)))
3032
->method('determineMutator')
@@ -48,7 +50,9 @@ public function testHydrateCallsMutatorsOnObject()
4850
);
4951

5052
// create mock
51-
$mock = $this->getMock('TestClass', array('setBar'));
53+
$mock = $this->getMockBuilder('TestClass')
54+
->setMethods(array('setBar'))
55+
->getMock();
5256

5357
$mock->expects($this->once())
5458
->method('setBar')

tests/PHPExif/Reader/ReaderTest.php

+8-11
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class ReaderTest extends \PHPUnit_Framework_TestCase
1616
*/
1717
public function setUp()
1818
{
19-
$adapter = $this->getMock('\PHPExif\Adapter\AdapterInterface');
19+
$adapter = $this->getMockBuilder('\PHPExif\Adapter\AdapterInterface')->getMockForAbstractClass();
2020
$this->reader = new \PHPExif\Reader\Reader($adapter);
2121
}
2222

@@ -26,7 +26,7 @@ public function setUp()
2626
*/
2727
public function testConstructorWithAdapter()
2828
{
29-
$mock = $this->getMock('\PHPExif\Adapter\AdapterInterface');
29+
$mock = $this->getMockBuilder('\PHPExif\Adapter\AdapterInterface')->getMockForAbstractClass();
3030
$reflProperty = new \ReflectionProperty('\PHPExif\Reader\Reader', 'adapter');
3131
$reflProperty->setAccessible(true);
3232

@@ -41,7 +41,7 @@ public function testConstructorWithAdapter()
4141
*/
4242
public function testGetAdapterFromProperty()
4343
{
44-
$mock = $this->getMock('\PHPExif\Adapter\AdapterInterface');
44+
$mock = $this->getMockBuilder('\PHPExif\Adapter\AdapterInterface')->getMockForAbstractClass();
4545

4646
$reflProperty = new \ReflectionProperty('\PHPExif\Reader\Reader', 'adapter');
4747
$reflProperty->setAccessible(true);
@@ -71,7 +71,7 @@ public function testGetAdapterThrowsExceptionWhenNoAdapterIsSet()
7171
*/
7272
public function testGetExifPassedToAdapter()
7373
{
74-
$adapter = $this->getMock('\PHPExif\Adapter\AdapterInterface');
74+
$adapter = $this->getMockBuilder('\PHPExif\Adapter\AdapterInterface')->getMockForAbstractClass();
7575
$adapter->expects($this->once())->method('getExifFromFile');
7676

7777
$reflProperty = new \ReflectionProperty('\PHPExif\Reader\Reader', 'adapter');
@@ -138,13 +138,10 @@ public function testFactoryAdapterTypeExiftool()
138138
*/
139139
public function testGetExifFromFileCallsReadMethod()
140140
{
141-
$mock = $this->getMock(
142-
'\\PHPExif\\Reader\\Reader',
143-
array('read'),
144-
array(),
145-
'',
146-
false
147-
);
141+
$mock = $this->getMockBuilder('\\PHPExif\\Reader\\Reader')
142+
->setMethods(array('read'))
143+
->disableOriginalConstructor()
144+
->getMock();
148145

149146
$expected = '/foo/bar/baz';
150147
$expectedResult = 'test';

0 commit comments

Comments
 (0)