Total Complexity | 4 |
Total Lines | 70 |
Duplicated Lines | 0 % |
Coverage | 81.25% |
Changes | 0 |
1 | <?php |
||
7 | abstract class Test extends TestCase |
||
8 | { |
||
9 | use Toolkit; |
||
10 | |||
11 | public $params = []; |
||
12 | |||
13 | public function setup() |
||
14 | { |
||
15 | $this->app = new class(getcwd(), $this) extends Application { |
||
16 | 1 | public function __construct(string $root, Test $testInstance) |
|
37 | }; |
||
38 | 1 | $this->dispatch('tarantool.migrate'); |
|
39 | 1 | } |
|
40 | |||
41 | public function tearDown() |
||
42 | { |
||
43 | $this->dispatch('tarantool.clear'); |
||
44 | } |
||
45 | |||
46 | public $mocks = []; |
||
47 | 1 | public function mock(string $job, array $params = []) |
|
48 | { |
||
49 | 1 | if (!array_key_exists($job, $this->mocks)) { |
|
50 | 1 | $this->mocks[$job] = []; |
|
51 | } |
||
52 | |||
53 | $mock = new class { |
||
54 | public $params; |
||
55 | public $result; |
||
56 | public function withParams($params) |
||
66 | }; |
||
67 | |||
68 | 1 | if (count($params)) { |
|
76 | } |
||
77 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: