render() public méthode

Render method
public render ( boolean $ret = false ) : mixed
$ret boolean
Résultat mixed
Exemple #1
0
 public function testRenderAndSave()
 {
     $c = new Generator(__DIR__ . '/../tmp/Test.php', Generator::CREATE_CLASS);
     $c->setNamespace(new NamespaceGenerator('Test\\Space'));
     $c->setBody('test body')->setClose(true);
     $c->appendToBody('more code');
     $body = $c->render(true);
     ob_start();
     $c->render();
     $output = ob_get_clean();
     $this->assertContains('namespace Test\\Space', $output);
     $c->save();
     $this->assertContains('test body', $body);
     $this->assertContains('more code', $body);
     $this->fileExists(__DIR__ . '/../tmp/Test.php');
     if (file_exists(__DIR__ . '/../tmp/Test.php')) {
         unlink(__DIR__ . '/../tmp/Test.php');
     }
 }