1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
From 1dad555b26c919ac42803f4d84b72af4aeb529d0 Mon Sep 17 00:00:00 2001
From: Markus Malkusch <markus@malkusch.de>
Date: Wed, 11 Nov 2015 23:43:41 +0100
Subject: [PATCH] [refactor] moved testDefineFunctionMock() into php-mock
---
tests/PHPMockTest.php | 33 +++++----------------------------
1 file changed, 5 insertions(+), 28 deletions(-)
diff --git a/tests/PHPMockTest.php b/tests/PHPMockTest.php
index dd0171c..fe59f78 100644
--- a/tests/PHPMockTest.php
+++ b/tests/PHPMockTest.php
@@ -17,6 +17,11 @@ class PHPMockTest extends AbstractMockTest
use PHPMock;
+ protected function defineFunction($namespace, $functionName)
+ {
+ self::defineFunctionMock($namespace, $functionName);
+ }
+
protected function mockFunction($namespace, $functionName, callable $function)
{
$mock = $this->getFunctionMock($namespace, $functionName);
@@ -28,34 +33,6 @@ protected function disableMocks()
}
/**
- * Tests defineFunctionMock().
- *
- * @test
- */
- public function testDefineFunctionMock()
- {
- self::defineFunctionMock(__NAMESPACE__, "escapeshellcmd");
- self::escapeshellcmd("foo");
-
- $mock = $this->getFunctionMock(__NAMESPACE__, "escapeshellcmd");
- $mock->expects($this->once())->willReturn("bar");
-
- $this->assertEquals("bar", self::escapeshellcmd("foo"));
- }
-
- /**
- * Returns the built-in call to escapeshellcmd().
- *
- * @param string $command Shell command.
- *
- * @return string The built-in call.
- */
- private static function escapeshellcmd($command)
- {
- return escapeshellcmd($command);
- }
-
- /**
* Tests building a mock with arguments.
*
* @test
|