Exemplo n.º 1
0
 public function testEncodeInvalidClass()
 {
     $schema = new CM_Model_Schema_Definition(array('foo' => array('type' => 'CM_Class_Abstract')));
     $exception = $this->catchException(function () use($schema) {
         $schema->encodeField('foo', 'bar');
     });
     $this->assertInstanceOf('CM_Model_Exception_Validation', $exception);
     /** @var CM_Model_Exception_Validation $exception */
     $this->assertSame('Value is not an instance of the class', $exception->getMessage());
     $this->assertSame(['value' => 'bar', 'className' => 'CM_Class_Abstract'], $exception->getMetaInfo());
 }
Exemplo n.º 2
0
 /**
  * @expectedException CM_Model_Exception_Validation
  * @expectedExceptionMessage Field `foo` is not a valid model
  */
 public function testEncodeInvalidClass()
 {
     $schema = new CM_Model_Schema_Definition(array('foo' => array('type' => 'CM_Class_Abstract')));
     $schema->encodeField('foo', 'bar');
 }