| 1 | <?php |
||
| 10 | class InputTest extends \PHPUnit_Framework_TestCase { |
||
| 11 | |||
| 12 | |||
| 13 | public function testElementRendering() { |
||
| 14 | $input = new Input(); |
||
| 15 | $input->setType('text'); |
||
| 16 | $input->setValue('value'); |
||
| 17 | $this->assertContains('<input type="text" value="value" ', $input->render()); |
||
| 18 | } |
||
| 19 | |||
| 20 | |||
| 21 | public function testHandleRequest() { |
||
| 22 | $input = new Input(); |
||
| 23 | $input->setName('email'); |
||
| 24 | |||
| 25 | $input->handle(new FormData(FormData::METHOD_POST, ['email' => '[email protected]'])); |
||
| 26 | $this->assertEquals('[email protected]', $input->getValue()); |
||
| 27 | $input->handle(new FormData(FormData::METHOD_POST, [])); |
||
| 28 | $this->assertNull($input->getValue()); |
||
| 29 | } |
||
| 30 | } |