public function testSetAndGetAndAddConstants() { $code = new PhpClass(); $code->setConstantCollection(new ConstantCollection(array(new Constant(array('name' => 'test1', 'value' => 1))))); $this->assertInstanceOf('\\ClassGeneration\\ConstantCollection', $code->getConstantCollection()); $this->assertInstanceOf('\\ClassGeneration\\Constant', $code->getConstantCollection()->current()); $this->assertCount(1, $code->getConstantCollection()); $this->assertEquals('test1', $code->getConstantCollection()->current()->getName()); $code->addConstant(new Constant(array('name' => 'test2', 'value' => 1))); $this->assertCount(2, $code->getConstantCollection()); $this->assertEquals('test2', $code->getConstantCollection()->last()->getName()); }