public function testWrite() { $code = new PhpClass(); $code->setName('FirstClass')->setNamespace(new NamespaceClass('ClassGenerator'))->setDescription('Class description')->setExtends('\\ArrayIterator')->addMethod(new Method())->addProperty(new Property()); $path = $this->path; if (!is_dir($path)) { $path = './data'; $i = 0; while ($i < 3 and !realpath($path)) { $path = '../' . $path; $i++; } } if (!is_dir($path)) { mkdir($path, 0777, true); } $writer = new Writer(array('phpClass' => $code, 'path' => $path)); $writer->write(); $this->assertFileExists($path . '/' . $code->getNamespace()->getPath() . '/' . $code->getName() . '.php'); }
public function testSetAndGetName() { $code = new PhpClass(); $code->setName('Test'); $this->assertEquals('Test', $code->getName()); }