public function testEntityIsAttachedToSessionAfterInserting() { $bug = new Bug('name', 1); $this->assertFalse($this->session->isAttached($bug)); $this->session->save($bug); // HACK: $this->assertNotNull($this->session->getIdentityMap()->get('Bug', 1)); }
public function testQueryManySubclasses() { $b = new Bug(); $b->setID(1); $b->setName("bug"); $fb = new FunctionalBug(); $fb->setID(2); $fb->setName("functional bug"); $fb->setSteps("some steps"); $tb = new TechnicalBug(); $tb->setID(3); $tb->setName("technical bug"); $tb->setErrorCode(124); $this->session->save($b); $this->session->save($fb); $this->session->save($tb); $this->session->flush(); $this->session->clear(); $bugs = $this->session->from("Bug")->find(); $this->assertThat($bugs[0], $this->isInstanceOf("Bug_OutletProxy")); $this->assertThat($bugs[1], $this->isInstanceOf("FunctionalBug_OutletProxy")); $this->assertThat($bugs[2], $this->isInstanceOf("TechnicalBug_OutletProxy")); }
protected function bulkInsertRecords($times) { $this->outletSession->setAutoFlush(false); for ($i = 0; $i < $times; $i++) { $user = new User($i, "Name {$i}"); $this->outletSession->save($user); } $this->outletSession->flush(false); $this->outletSession->setAutoFlush(true); }