blob: dba8c98988e91d7ff8e7262e5244cf7de3aa040e (
plain)
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
|
<?php
namespace Engelsystem\Test\Unit;
use Engelsystem\Application;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\MockObject\Rule\InvocationOrder;
use PHPUnit\Framework\TestCase as PHPUnitTestCase;
abstract class TestCase extends PHPUnitTestCase
{
/** @var Application */
protected $app;
/**
* @param MockObject $object
* @param string $method
* @param array $arguments
* @param mixed $return
* @param InvocationOrder $times
*/
protected function setExpects($object, $method, $arguments = null, $return = null, $times = null)
{
if (is_null($times)) {
$times = $this->once();
}
$invocation = $object->expects($times)
->method($method);
if (is_null($arguments)) {
$invocation->withAnyParameters();
} else {
call_user_func_array([$invocation, 'with'], $arguments);
}
if (!is_null($return)) {
$invocation->willReturn($return);
}
}
/**
* Called before each test run
*/
protected function setUp(): void
{
$this->app = new Application(__DIR__ . '/../../');
}
}
|