File tree 1 file changed +28
-6
lines changed
1 file changed +28
-6
lines changed Original file line number Diff line number Diff line change 1
1
<?php
2
+ // disable the mock by default
3
+ namespace
4
+ {
5
+ $ mockProcOpen = false ;
6
+ }
2
7
3
- namespace PHPExif \Tests \Adapter {
8
+ // same namespace as SUT
9
+ namespace PHPExif \Adapter
10
+ {
4
11
5
- function proc_open ()
12
+ // stub the function
13
+ function proc_open ($ cmd , array $ descriptorspec , &$ pipes = array ())
6
14
{
15
+ global $ mockProcOpen ;
16
+ if (isset ($ mockProcOpen ) && !$ mockProcOpen ) {
17
+ return \proc_open (
18
+ $ cmd ,
19
+ $ descriptorspec ,
20
+ $ pipes
21
+ );
22
+ }
7
23
return false ;
8
24
}
9
25
10
- include __DIR__ . '/../../../lib/PHPExif/Adapter/Exiftool.php ' ;
11
-
12
26
/**
13
27
* @covers \PHPExif\Adapter\Exiftool::<!public>
14
28
*/
@@ -21,11 +35,21 @@ class ExiftoolProcOpenTest extends \PHPUnit_Framework_TestCase
21
35
22
36
public function setUp ()
23
37
{
38
+ global $ mockProcOpen ;
39
+ $ mockProcOpen = true ;
24
40
$ this ->adapter = new \PHPExif \Adapter \Exiftool ();
25
41
}
42
+
43
+ public function tearDown ()
44
+ {
45
+ global $ mockProcOpen ;
46
+ $ mockProcOpen = false ;
47
+ }
48
+
26
49
/**
27
50
* @group exiftool
28
51
* @covers \PHPExif\Adapter\Exiftool::getCliOutput
52
+ * @expectedException RuntimeException
29
53
*/
30
54
public function testGetCliOutput ()
31
55
{
@@ -39,8 +63,6 @@ public function testGetCliOutput()
39
63
'pwd '
40
64
)
41
65
);
42
-
43
- $ this ->assertInternalType ('string ' , $ result );
44
66
}
45
67
}
46
68
}
You can’t perform that action at this time.
0 commit comments