Skip to content

Commit 33cba78

Browse files
author
Tom Van Herreweghe
committed
Fixed unit test for php 5.3.x
1 parent c099c87 commit 33cba78

File tree

2 files changed

+20
-18
lines changed

2 files changed

+20
-18
lines changed

lib/PHPExif/Reader.php

+17-15
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,17 @@ class Reader
2727
{
2828
const TYPE_NATIVE = 'native';
2929
const TYPE_EXIFTOOL = 'exiftool';
30-
30+
3131
/**
3232
* The current adapter
3333
*
3434
* @var \PHPExif\Reader\AdapterInterface
3535
*/
3636
protected $adapter;
37-
37+
3838
/**
3939
* Reader constructor
40-
*
40+
*
4141
* @param \PHPExif\Reader\AdapterInterface $adapter
4242
*/
4343
public function __construct(AdapterInterface $adapter = null)
@@ -46,23 +46,23 @@ public function __construct(AdapterInterface $adapter = null)
4646
$this->setAdapter($adapter);
4747
}
4848
}
49-
49+
5050
/**
5151
* Setter for the reader adapter
52-
*
52+
*
5353
* @param \PHPExif\Reader\AdapterInterface $adapter
5454
* @return \PHPExif\Reader Current instance for chaining
5555
*/
5656
public function setAdapter(AdapterInterface $adapter)
5757
{
5858
$this->adapter = $adapter;
59-
59+
6060
return $this;
6161
}
62-
62+
6363
/**
6464
* Getter for the reader adapter
65-
*
65+
*
6666
* @return \PHPExif\Reader\AdapterInterface
6767
* @throws NoAdapterException When no adapter is set
6868
*/
@@ -71,36 +71,38 @@ public function getAdapter()
7171
if (empty($this->adapter)) {
7272
throw new NoAdapterException('No adapter set in the reader');
7373
}
74-
74+
7575
return $this->adapter;
7676
}
77-
77+
7878
/**
7979
* Factory for the reader
80-
*
80+
*
8181
* @param string $type
8282
* @return \PHPExif\Reader
8383
* @throws \InvalidArgumentException When given type is invalid
8484
*/
8585
public static function factory($type)
8686
{
8787
$classname = get_called_class();
88-
88+
89+
$adapter = null;
8990
switch ($type) {
9091
case self::TYPE_NATIVE:
9192
$adapter = new Reader\Adapter\Native();
92-
return new $classname($adapter);
93+
break;
9394
case self::TYPE_EXIFTOOL:
9495
$adapter = new Reader\Adapter\Exiftool();
95-
return new $classname($adapter);
96+
break;
9697
default:
9798
throw new \InvalidArgumentException(
9899
sprintf('Unknown type "%1$s"', $type)
99100
);
100101
break;
101102
}
103+
return new $classname($adapter);
102104
}
103-
105+
104106
/**
105107
* Reads & parses the EXIF data from given file
106108
*

tests/PHPExif/Reader/Adapter/ExiftoolTest.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function testSetToolPathInProperty()
3434
$reflProperty = new \ReflectionProperty('\PHPExif\Reader\Adapter\Exiftool', 'toolPath');
3535
$reflProperty->setAccessible(true);
3636

37-
$expected = PHP_BINARY;
37+
$expected = '/tmp';
3838
$this->adapter->setToolPath($expected);
3939

4040
$this->assertEquals($expected, $reflProperty->getValue($this->adapter));
@@ -138,8 +138,8 @@ public function testGetCliOutput()
138138
$result = $reflMethod->invoke(
139139
$this->adapter,
140140
sprintf(
141-
'%1$s -v',
142-
PHP_BINARY
141+
'%1$s',
142+
'pwd'
143143
)
144144
);
145145

0 commit comments

Comments
 (0)