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); }
/** * 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')); }