Files
piratepoet/tests/unit/Models/ModelValidatorTest.php
Pavel Dohnal b80683a9a1 Fix unit tests for PHPUnit v6
Codeception from version 2.3 up comes with PHPUnit v6 which changed
__construct behaviour. Our tests have to call parent __constructor in
order to work. The error was:
[PHPUnit\Framework\Exception] array_merge(): Argument #1 is not an array
2017-06-07 11:32:33 +01:00

26 lines
718 B
PHP

<?php
use MailPoet\Models\ModelValidator;
class ModelValidatorTest extends MailPoetTest {
public $validator;
function __construct() {
parent::__construct();
$this->validator = new ModelValidator();
}
function testItConfiguresValidators() {
$configured_validators = $this->validator->getValidators();
foreach(array_keys($this->validator->validators) as $validator) {
expect($configured_validators)->contains($validator);
}
}
function testItValidatesEmail() {
expect($this->validator->validateEmail('test'))->false();
expect($this->validator->validateEmail('tést@éxample.com'))->false();
expect($this->validator->validateEmail('test@example.com'))->true();
}
}