/** * @covers FOF30\Layout\LayoutFile::getPath * * @dataProvider FOF30\Tests\Layout\LayoutFileTestProvider::getTestGetPath * * @param string $layoutId The layout to load * @param array $platformSetup Platform setup (baseDirs, template, templateSuffixes) * @param string $expectedPath The expected path which should be returned * @param string $message Failure message */ public function testGetPath($layoutId, $platformSetup, $expectedPath, $message) { // Set up the platform $defaultPlatformSetup = array('baseDirs' => null, 'template' => null, 'templateSuffixes' => null); if (!is_array($platformSetup)) { $platformSetup = array(); } $platformSetup = array_merge($defaultPlatformSetup, $platformSetup); $reflector = new \ReflectionClass('FOF30\\Tests\\Helpers\\TestJoomlaPlatform'); foreach ($platformSetup as $k => $v) { $reflector->setStaticPropertyValue($k, $v); } unset($reflector); // Set up a fake options JRegistry object $fakeOptions = new \JRegistry(array('option' => 'com_foobar', 'client' => 0)); $fakeBase = realpath(__DIR__ . '/../_data/layout/base'); // Create the layout file object $layoutFile = new LayoutFile($layoutId, $fakeBase, $fakeOptions); $layoutFile->container = static::$container; // Call the protected method. Dirty, but that's what we have to test without loading and displaying an actual // PHP file. $actual = ReflectionHelper::invoke($layoutFile, 'getPath'); $this->assertEquals($expectedPath, $actual, $message); }
/** * @dataProvider getTestBin2StrExceptions */ public function testFromBinExceptions($crapData, $message) { $this->setExpectedException('\\Exception'); ReflectionHelper::invoke($this->base32, 'fromBin', $crapData); }
/** * @group TreeModelScopeImmediateDescendants * @group TreeModel * @covers FOF30\Model\TreeModel::scopeImmediateDescendants */ public function testScopeImmediateDescendantsException() { $this->setExpectedException('FOF30\\Model\\DataModel\\Exception\\TreeInvalidLftRgtCurrent'); $config = array('autoChecks' => false, 'idFieldName' => 'foftest_nestedset_id', 'tableName' => '#__foftest_nestedsets'); $table = new TreeModelStub(static::$container, $config); ReflectionHelper::invoke($table, 'scopeImmediateDescendants'); }
/** * Test the protected _getLink method * * @param Link $link The link to test with * @param array $expected The expected return array * * @dataProvider getTestGetLink * * @covers FOF30\Hal\Render\Json::_getLink * * @return Json */ public function testGetLink(Link $link, array $expected) { $renderer = new Json($this->document); $result = ReflectionHelper::invoke($renderer, '_getLink', $link); $this->assertEquals($expected, (array) $result, 'Line: ' . __LINE__ . '.'); }