| Conditions | 1 |
| Paths | 1 |
| Total Lines | 23 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 9 | public function testValidate() |
||
| 10 | { |
||
| 11 | $validator = new Validator(); |
||
| 12 | $validator->add('RestService[email]', ['rule' => 'required | email'], '[email protected]'); |
||
| 13 | $validator->add('RestService[website]', ['rule' => 'url', 'defaultValue' => 'http://example.com'], ''); |
||
| 14 | $validator->isValid(); |
||
| 15 | |||
| 16 | $this->assertEquals( |
||
| 17 | [ |
||
| 18 | 'RestService[email]' => 'required | email', |
||
| 19 | 'RestService[website]' => 'url', |
||
| 20 | ], |
||
| 21 | $validator->getRules() |
||
| 22 | ); |
||
| 23 | |||
| 24 | $this->assertEquals( |
||
| 25 | [ |
||
| 26 | 'RestService[email]' => '[email protected]', |
||
| 27 | 'RestService[website]' => 'http://example.com', |
||
| 28 | ], |
||
| 29 | $validator->getDatas() |
||
| 30 | ); |
||
| 31 | } |
||
| 32 | |||
| 64 |