/** * Provides the data for the getCode() test. * @return array The data. */ public function provideGetCode() { /* @var $renderedCode \ManiaScript\Builder\RenderedCode|\PHPUnit_Framework_MockObject_MockObject */ $renderedCode = $this->getMockBuilder('ManiaScript\\Builder\\RenderedCode')->setMethods(array('getContextDirective'))->getMock(); $renderedCode->expects($this->any())->method('getContextDirective')->will($this->returnValue('abc')); $renderedCode->setDirectives('def')->setGlobalCode('ghi')->setMainFunction('jkl'); $options = new Options(); $options->setRenderContextDirective(false)->setRenderDirectives(false)->setRenderGlobalCode(false)->setRenderMainFunction(false)->setCompress(false)->setIncludeScriptTag(false); $optionsContext = clone $options; $optionsContext->setRenderContextDirective(true); $optionsDirectives = clone $options; $optionsDirectives->setRenderDirectives(true); $optionsGlobalCode = clone $options; $optionsGlobalCode->setRenderGlobalCode(true); $optionsMainFunction = clone $options; $optionsMainFunction->setRenderMainFunction(true); $optionsCompress = clone $options; $optionsCompress->setRenderContextDirective(true)->setCompress(true); $optionsScriptTag = clone $options; $optionsScriptTag->setRenderContextDirective(true)->setIncludeScriptTag(true); $optionsAll = clone $options; $optionsAll->setRenderContextDirective(true)->setRenderDirectives(true)->setRenderGlobalCode(true)->setRenderMainFunction(true)->setCompress(true)->setIncludeScriptTag(true); return array(array('', $options, $renderedCode, null, null, null, null), array('abc', $optionsContext, $renderedCode, null, null, null, null), array('def', $optionsDirectives, $renderedCode, null, null, null, null), array('ghi', $optionsGlobalCode, $renderedCode, null, null, null, null), array('jkl', $optionsMainFunction, $renderedCode, null, null, null, null), array('foo', $optionsCompress, $renderedCode, 'abc', 'foo', null, null), array('bar', $optionsScriptTag, $renderedCode, null, null, 'abc', 'bar'), array('bar', $optionsAll, $renderedCode, 'abcdefghijkl', 'foo', 'foo', 'bar')); }
/** * Tests the setRenderContextDirective() method. * @covers \ManiaScript\Builder\Options::setRenderContextDirective */ public function testSetRenderContextDirective() { $expected = false; $options = new Options(); $result = $options->setRenderContextDirective($expected); $this->assertEquals($options, $result); $this->assertPropertyEquals($expected, $options, 'renderContextDirective'); }