Conditions | 1 |
Paths | 1 |
Total Lines | 42 |
Code Lines | 27 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
22 | public function testCreateClass() |
||
23 | { |
||
24 | $this->provider->getId()->willReturn(1); |
||
25 | $this->provider->getEntitySpec()->willReturn([ |
||
26 | [ |
||
27 | 'name' => 'id', |
||
28 | 'type' => 'integer', |
||
29 | 'nullable' => false, |
||
30 | ], |
||
31 | [ |
||
32 | 'name' => 'name', |
||
33 | 'type' => 'string', |
||
34 | 'nullable' => true, |
||
35 | ], |
||
36 | [ |
||
37 | 'name' => 'email', |
||
38 | 'type' => 'string', |
||
39 | 'nullable' => false, |
||
40 | ], |
||
41 | ]); |
||
42 | $this->provider->getPostParams()->willReturn([ |
||
43 | 'name' => 'bob', |
||
44 | 'email' => '[email protected]', |
||
45 | ]); |
||
46 | $this->provider->getParams()->willReturn([ |
||
47 | 'id' => 1, |
||
48 | 'name' => 'bob', |
||
49 | 'email' => '[email protected]', |
||
50 | ]); |
||
51 | $this->provider->getBaseName()->willReturn('User'); |
||
52 | $this->provider->getShortName()->willReturn('user'); |
||
53 | $this->provider->getEntityClassName()->willReturn('Dummy\\User'); |
||
54 | $this->provider->hasUnique()->willReturn(true); |
||
55 | $this->provider->getIdName()->willReturn('id'); |
||
56 | |||
57 | $delete = new Delete('Dummy\\User', $this->factory->reveal()); |
||
58 | |||
59 | $code = $delete->generate(); |
||
60 | $this->assertNotEmpty($code); |
||
61 | |||
62 | // asserting php code is valid and can be loaded |
||
63 | CodeLoader::loadCode($code, 'DeleteCest.php'); |
||
64 | } |
||
66 |