| 1 | <?php |
||
| 7 | class EmailsValidationFormTest extends \Codeception\Test\Unit |
||
| 8 | { |
||
| 9 | use ModelTestTrait; |
||
| 10 | |||
| 11 | /** |
||
| 12 | * @var \andmemasin\emailsvalidator\UnitTester |
||
| 13 | */ |
||
| 14 | protected $tester; |
||
| 15 | |||
| 16 | /** @var EmailsValidationForm */ |
||
| 17 | protected $model; |
||
| 18 | |||
| 19 | |||
| 20 | protected function _before() |
||
| 21 | { |
||
| 22 | $this->model = $this->baseObject(); |
||
| 23 | } |
||
| 24 | |||
| 25 | protected function _after() |
||
| 26 | { |
||
| 27 | } |
||
| 28 | |||
| 29 | public function testLoadEmailAddresses() { |
||
| 30 | $this->model->textInput = "[email protected]\[email protected],[email protected]"; |
||
| 31 | $result = $this->invokeMethod($this->model, 'loadEmailAddresses'); |
||
| 32 | $this->assertEquals(2, count($this->model->emailAddresses)); |
||
| 33 | $this->assertEquals(1, count($this->model->failingEmailAddresses)); |
||
| 34 | } |
||
| 35 | |||
| 36 | public function testProcess() { |
||
| 37 | $this->assertEquals(true, $this->model->process()); |
||
| 38 | } |
||
| 39 | |||
| 40 | |||
| 41 | |||
| 42 | /** |
||
| 43 | * Returns a good working LimeSurvey collector |
||
| 44 | * @return EmailsValidationForm |
||
| 45 | */ |
||
| 46 | public function baseObject(){ |
||
| 47 | $model = new EmailsValidationForm(); |
||
| 48 | return $model; |
||
| 49 | } |
||
| 50 | |||
| 51 | } |