/** * Tests the getContextDirective() method. * @covers \ManiaScript\Builder\RenderedCode::getContextDirective */ public function testGetContextDirective() { $expected = '#RequireContext CMlBrowser' . PHP_EOL; $renderedCode = new RenderedCode(); $result = $renderedCode->getContextDirective(); $this->assertEquals($expected, $result); }
/** * Returns the rendered ManiaScript code. * @return string The code. */ public function getCode() { $result = ''; if ($this->options->getRenderContextDirective()) { $result .= $this->renderedCode->getContextDirective(); } if ($this->options->getRenderDirectives()) { $result .= $this->renderedCode->getDirectives(); } if ($this->options->getRenderGlobalCode()) { $result .= $this->renderedCode->getGlobalCode(); } if ($this->options->getRenderMainFunction()) { $result .= $this->renderedCode->getMainFunction(); } if ($this->options->getCompress()) { $result = $this->compress($result); } if ($this->options->getIncludeScriptTag()) { $result = $this->addScriptTag($result); } return $result; }