public function testSetAndGetAndAddMethods() { $code = new PhpClass(); $code->setMethodCollection(new MethodCollection(array(new Method(array('name' => 'test1'))))); $this->assertInstanceOf('\\ClassGeneration\\MethodCollection', $code->getMethodCollection()); $this->assertInstanceOf('\\ClassGeneration\\Method', $code->getMethodCollection()->current()); $this->assertCount(1, $code->getMethodCollection()); $this->assertEquals('test1', $code->getMethodCollection()->current()->getName()); $code->addMethod(new Method(array('name' => 'test2'))); $this->assertCount(2, $code->getMethodCollection()); $this->assertEquals('test2', $code->getMethodCollection()->last()->getName()); }