lithium\tests\cases\data\EntityTest::testErrors PHP Method

testErrors() public method

public testErrors ( )
    public function testErrors()
    {
        $entity = new Entity();
        $errors = array('foo' => 'Something bad happened.');
        $this->assertEqual(array(), $entity->errors());
        $entity->errors($errors);
        $this->assertEqual($errors, $entity->errors());
        $this->assertEqual('Something bad happened.', $entity->errors('foo'));
        $otherError = array('bar' => 'Something really bad happened.');
        $errors += $otherError;
        $entity->errors($otherError);
        $this->assertEqual($errors, $entity->errors());
        $this->assertCount(2, $entity->errors());
        $this->assertEqual('Something bad happened.', $entity->errors('foo'));
        $this->assertEqual('Something really bad happened.', $entity->errors('bar'));
    }