-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathRegressionTest.php
44 lines (38 loc) · 1.03 KB
/
RegressionTest.php
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
<?php
namespace phpmock\prophecy;
use PHPUnit\Framework\TestCase;
use Prophecy\Prophet;
/**
* Regression tests for Prophecy.
*
* @author Markus Malkusch <[email protected]>
* @link bitcoin:1335STSwu9hST4vcMRppEPgENMHD2r1REK Donations
* @license http://www.wtfpl.net/txt/copying/ WTFPL
*/
final class RegressionTest extends TestCase
{
/**
* Calling no optional parameter
*
* @test
* @see https://github.com/php-mock/php-mock-prophecy/issues/1
*/
public function expectingWithoutOptionalParameter()
{
$prophet = new Prophet();
$prophecy = $prophet->prophesize(OptionalParameterHolder::class);
$prophecy->call("arg1")->willReturn("mocked");
$mock = $prophecy->reveal();
$this->assertEquals("mocked", $mock->call("arg1"));
$prophet->checkPredictions();
}
}
// @codingStandardsIgnoreStart
class OptionalParameterHolder
{
public function call($arg1, $optional = "optional")
{
return $arg1 . $optional;
}
}
// @codingStandardsIgnoreEnd