public function testGetParentOrCreateExistingParent() { ConcreteContentQuery::create()->deleteAll(); ConcreteArticleQuery::create()->deleteAll(); $content = new ConcreteContent(); $content->save(); $id = $content->getId(); ConcreteContentPeer::clearInstancePool(); $article = new ConcreteArticle(); $article->setId($id); $article->save(); $this->assertEquals($id, $article->getId(), 'getParentOrCreate() keeps manually set pk'); $this->assertEquals(1, ConcreteContentQuery::create()->count(), 'getParentOrCreate() creates no new parent entry'); }
public function testSetPkAllowPkInsertIsFalse() { ConcreteContentQuery::create()->deleteAll(); ConcreteArticleQuery::create()->deleteAll(); try { $article = new ConcreteArticle(); $article->setId(4); $article->save(); $this->fail('SetPk fails when allowPkInsert is false'); } catch (PropelException $e) { $this->assertTrue(true, 'SetPk fails when allowPkInsert is false'); } }