Phalcon\Test\Unit\Validation\Validator\AlphaTest::testShouldDetectNonAlphabeticCharacters PHP Method

testShouldDetectNonAlphabeticCharacters() public method

Tests Non Alphabetic Characters
Since: 2016-06-10
Author: Serghei Iakovlev ([email protected])
    public function testShouldDetectNonAlphabeticCharacters()
    {
        $this->specify("The Alpha Validator does not detect non alphabetic characters", function ($input) {
            $validation = new Validation();
            $validation->add('name', new Alpha(['message' => ':field must contain only letters']));
            $messages = $validation->validate(['name' => $input]);
            $expectedMessages = Group::__set_state(['_messages' => [Message::__set_state(['_type' => 'Alpha', '_message' => 'name must contain only letters', '_field' => 'name', '_code' => '0'])]]);
            expect($messages)->equals($expectedMessages);
        }, ['examples' => [['1'], [123], ['a-b-c-d'], ['a-1-c-2'], ['a1c2'], ['o0o0o0o0']]]);
    }