These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace Test; |
||
4 | |||
5 | use Basis\Test; |
||
6 | use Basis\Test\Mapper; |
||
7 | use Basis\Test\Repository; |
||
8 | |||
9 | class MapperTest extends Test |
||
10 | { |
||
11 | public $data = [ |
||
12 | 'flow.tracker' => [ |
||
13 | [], // use id generator |
||
14 | ], |
||
15 | ]; |
||
16 | |||
17 | public function testFakeMapper() |
||
18 | { |
||
19 | $this->assertCount(1, $this->find('flow.tracker')); |
||
20 | $this->assertSame(1, $this->findOrFail('flow.tracker')->id); |
||
21 | $this->assertNotNull($this->findOrFail('flow.tracker', 1)); |
||
0 ignored issues
–
show
|
|||
22 | $this->assertNull($this->findOne('flow.tracker', 2)); |
||
0 ignored issues
–
show
2 is of type integer , but the function expects a array .
It seems like the type of the argument is not accepted by the function/method which you are calling. In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug. We suggest to add an explicit type cast like in the following example: function acceptsInteger($int) { }
$x = '123'; // string "123"
// Instead of
acceptsInteger($x);
// we recommend to use
acceptsInteger((integer) $x);
Loading history...
|
|||
23 | |||
24 | $tracker = $this->create('flow.tracker', [ 'status' => 'ready', ]); |
||
25 | $this->assertSame($tracker->status, 'ready'); |
||
26 | $this->assertSame($tracker->id, 2); |
||
27 | |||
28 | $this->assertCount(2, $this->find('flow.tracker')); |
||
29 | $this->assertCount(1, $this->find('flow.tracker', [ 'status' => 'ready' ])); |
||
30 | |||
31 | $this->assertInstanceOf(Repository::class, $this->getRepository('flow.tracker')); |
||
32 | |||
33 | $mapper = $this->getRepository('flow.tracker')->getMapper(); |
||
34 | $this->assertInstanceOf(Mapper::class, $mapper); |
||
35 | $this->assertNotNull($mapper); |
||
36 | |||
37 | $mapper->remove('tracker', [ 'id' => 1 ]); |
||
38 | $this->assertCount(1, $this->find('flow.tracker')); |
||
39 | $this->assertSame(2, $this->findOne('flow.tracker')->id); |
||
40 | $tracker = $this->create('flow.tracker', [ 'status' => 'ready', ]); |
||
41 | $this->assertSame($tracker->status, 'ready'); |
||
42 | $this->assertSame($tracker->id, 3); |
||
43 | $this->assertCount(2, $this->find('flow.tracker')); |
||
44 | $this->assertNotNull($this->findOrFail('flow.tracker', 3)); |
||
0 ignored issues
–
show
3 is of type integer , but the function expects a array .
It seems like the type of the argument is not accepted by the function/method which you are calling. In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug. We suggest to add an explicit type cast like in the following example: function acceptsInteger($int) { }
$x = '123'; // string "123"
// Instead of
acceptsInteger($x);
// we recommend to use
acceptsInteger((integer) $x);
Loading history...
|
|||
45 | |||
46 | $this->create('flow.tracker', ['status' => 'draft']); |
||
47 | $this->assertCount(3, $this->find('flow.tracker')); |
||
48 | |||
49 | $this->remove('flow.tracker', ['status' => 'ready']); |
||
50 | $this->assertCount(1, $this->find('flow.tracker')); |
||
51 | $this->getRepository('flow.tracker')->remove($this->findOne('flow.tracker')); |
||
52 | |||
53 | $this->assertCount(0, $this->find('flow.tracker')); |
||
54 | } |
||
55 | } |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: