Example #1
0
 /**
  * @covers Model::insertIntoPool
  * @covers Model::retrieveFromPool
  * @covers Model::removeFromPool
  * @covers Model::flushPool
  */
 public function testInstancePool()
 {
     TestModel::insertIntoPool($this->instance);
     $this->assertNull(TestModel::retrieveFromPool($this->instance->getId()));
     $this->assertEquals(0, TestModel::$_instancePoolCount);
     $this->instance->setId(1);
     TestModel::insertIntoPool($this->instance);
     $this->assertSame($this->instance, TestModel::retrieveFromPool($this->instance->getId()));
     TestModel::removeFromPool($this->instance);
     $this->assertEquals(0, TestModel::$_instancePoolCount);
     TestModel::insertIntoPool($this->instance);
     TestModel::insertIntoPool($this->instance);
     $this->assertEquals(1, TestModel::$_instancePoolCount);
     TestModel::flushPool();
     $this->assertNull(TestModel::retrieveFromPool($this->instance->getId()));
     $this->assertEquals(0, TestModel::$_instancePoolCount);
 }