Skip to content

Commit b8df243

Browse files
Mathieu LOUVELMathieu LOUVEL
authored andcommitted
Add test
1 parent b13edef commit b8df243

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

tests/unit/VerifierTest.php

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public function testVerifyMagicMethods()
7474

7575
public function testverifyWithMutliplesParams()
7676
{
77-
$this->specify('works for instance proxy', function() {
77+
$this->specify('works for instance proxy', function () {
7878
// Set up user object.
7979
$user = new UserModel(['name' => "John Smith"]);
8080
double::registerObject($user);
@@ -85,20 +85,29 @@ public function testverifyWithMutliplesParams()
8585

8686
// Assert rename was counted.
8787
$user->verifyInvoked('setName', "Bob Jones");
88+
// if verifyInvoked is ok, verifyNeverInvoked have to fail
89+
try {
90+
$user->verifyNeverInvoked('setName', "Bob Jones");
91+
// If i dont fail, my test fail
92+
throw new fail('verifyNeverInvoked');
93+
} catch (\Exception $e) {}
94+
8895
$user->verifyNeverInvoked('setName', ["Boby Jones"]);
8996

9097
// call function with multiple params
9198
$user->setNameAndInfo("Bob Jones", "Infos");
9299

93100
// verify
94-
$user->verifyInvoked('setNameAndInfo',["Bob Jones", "Infos"]);
101+
$user->verifyInvoked('setNameAndInfo', ["Bob Jones", "Infos"]);
95102

96103
// if verifyInvoked is ok, verifyNeverInvoked have to fail
97104
try {
98105
$user->verifyNeverInvoked('setNameAndInfo', ["Bob Jones", "Infos"]);
99106
// If i dont fail, my test fail
100107
throw new fail('verifyNeverInvoked');
101-
} catch (\Exception $e) {}
108+
} catch (\Exception $e) {
109+
110+
}
102111
});
103112
}
104113
}

0 commit comments

Comments
 (0)