Пример #1
0
 public function testDeleteError()
 {
     $this->setExpectedException("RuntimeException", "You can not delete an non persisted Entity");
     $entity = new TestEntity();
     $entity->set("name", "testname");
     $entity->set("key", "key_123456");
     $pdoStub = $this->getMock("TestPDO");
     $database = new Database($pdoStub);
     $database->delete($entity);
 }
Пример #2
0
 /**
  * Tests that just accessing the translation will mark the property as dirty, this
  * is to facilitate the saving process by not having to remember to mark the property
  * manually
  *
  * @return void
  */
 public function testTranslationDirty()
 {
     $entity = new TestEntity();
     $entity->set('_translations', ['eng' => new Entity(['title' => 'My Title']), 'spa' => new Entity(['title' => 'Titulo'])]);
     $entity->clean();
     $this->assertEquals('My Title', $entity->translation('eng')->get('title'));
     $this->assertTrue($entity->dirty('_translations'));
 }