Initial commit
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
namespace FluidTYPO3\Vhs\Tests\Unit\ViewHelpers\Extension;
|
||||
|
||||
/*
|
||||
* This file is part of the FluidTYPO3/Vhs project under GPLv2 or later.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.md file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use FluidTYPO3\Vhs\Tests\Unit\ViewHelpers\AbstractViewHelperTest;
|
||||
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
|
||||
|
||||
/**
|
||||
* @protection on
|
||||
* @author Claus Due <claus@namelesscoder.net>
|
||||
* @package Vhs
|
||||
* @subpackage ViewHelpers\Extension
|
||||
*/
|
||||
class IconViewHelperTest extends AbstractViewHelperTest {
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function rendersUsingArgument() {
|
||||
$test = $this->executeViewHelper(array('extensionName' => 'Vhs'));
|
||||
$this->assertSame(ExtensionManagementUtility::extPath('vhs', 'ext_icon.gif'), $test);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function rendersUsingControllerContext() {
|
||||
$test = $this->executeViewHelper(array(), array(), NULL, 'Vhs');
|
||||
$this->assertSame(ExtensionManagementUtility::extPath('vhs', 'ext_icon.gif'), $test);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function throwsErrorWhenUnableToDetectExtensionName() {
|
||||
$this->setExpectedException('RuntimeException', NULL, 1364167519);
|
||||
$this->executeViewHelper(array(), array(), NULL, NULL, 'FakePlugin');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
namespace FluidTYPO3\Vhs\Tests\Unit\ViewHelpers\Extension;
|
||||
|
||||
/*
|
||||
* This file is part of the FluidTYPO3/Vhs project under GPLv2 or later.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.md file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use FluidTYPO3\Vhs\Tests\Unit\ViewHelpers\AbstractViewHelperTest;
|
||||
|
||||
/**
|
||||
* @protection on
|
||||
* @author Claus Due <claus@namelesscoder.net>
|
||||
* @package Vhs
|
||||
* @subpackage ViewHelpers\Extension
|
||||
*/
|
||||
class LoadedViewHelperTest extends AbstractViewHelperTest {
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function rendersThenChildIfExtensionIsLoaded() {
|
||||
$arguments = array(
|
||||
'extensionName' => 'Vhs',
|
||||
'then' => 1, '
|
||||
else' => 0
|
||||
);
|
||||
$result = $this->executeViewHelper($arguments);
|
||||
$this->assertSame(1, $result);
|
||||
|
||||
$staticResult = $this->executeViewHelperStatic($arguments);
|
||||
$this->assertEquals($result, $staticResult, 'The regular viewHelper output doesn\'t match the static output!');
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function rendersElseChildIfExtensionIsNotLoaded() {
|
||||
$arguments = array(
|
||||
'extensionName' => 'Void',
|
||||
'then' => 1,
|
||||
'else' => 0
|
||||
);
|
||||
$result = $this->executeViewHelper($arguments);
|
||||
$this->assertSame(0, $result);
|
||||
|
||||
$staticResult = $this->executeViewHelperStatic($arguments);
|
||||
$this->assertEquals($result, $staticResult, 'The regular viewHelper output doesn\'t match the static output!');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
namespace FluidTYPO3\Vhs\Tests\Unit\ViewHelpers\Extension\Path;
|
||||
|
||||
/*
|
||||
* This file is part of the FluidTYPO3/Vhs project under GPLv2 or later.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.md file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use FluidTYPO3\Vhs\Tests\Unit\ViewHelpers\AbstractViewHelperTest;
|
||||
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
|
||||
|
||||
/**
|
||||
* @protection on
|
||||
* @author Claus Due <claus@namelesscoder.net>
|
||||
* @package Vhs
|
||||
* @subpackage ViewHelpers\Extension\Path
|
||||
*/
|
||||
class AbsoluteViewHelperTest extends AbstractViewHelperTest {
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function rendersUsingArgument() {
|
||||
$test = $this->executeViewHelper(array('extensionName' => 'Vhs'));
|
||||
$this->assertSame(ExtensionManagementUtility::extPath('vhs'), $test);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function rendersUsingControllerContext() {
|
||||
$test = $this->executeViewHelper(array(), array(), NULL, 'Vhs');
|
||||
$this->assertSame(ExtensionManagementUtility::extPath('vhs'), $test);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function throwsErrorWhenUnableToDetectExtensionName() {
|
||||
$this->setExpectedException('RuntimeException', NULL, 1364167519);
|
||||
$this->executeViewHelper(array(), array(), NULL, NULL, 'FakePlugin');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
namespace FluidTYPO3\Vhs\Tests\Unit\ViewHelpers\Extension\Path;
|
||||
|
||||
/*
|
||||
* This file is part of the FluidTYPO3/Vhs project under GPLv2 or later.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.md file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use FluidTYPO3\Vhs\Tests\Unit\ViewHelpers\AbstractViewHelperTest;
|
||||
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
|
||||
|
||||
/**
|
||||
* @protection on
|
||||
* @author Claus Due <claus@namelesscoder.net>
|
||||
* @package Vhs
|
||||
* @subpackage ViewHelpers\Extension\Path
|
||||
*/
|
||||
class RelativeViewHelperTest extends AbstractViewHelperTest {
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function rendersUsingArgument() {
|
||||
$test = $this->executeViewHelper(array('extensionName' => 'Vhs'));
|
||||
$this->assertSame(ExtensionManagementUtility::extRelPath('vhs'), $test);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function rendersUsingControllerContext() {
|
||||
$test = $this->executeViewHelper(array(), array(), NULL, 'Vhs');
|
||||
$this->assertSame(ExtensionManagementUtility::extRelPath('vhs'), $test);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function throwsErrorWhenUnableToDetectExtensionName() {
|
||||
$this->setExpectedException('RuntimeException', NULL, 1364167519);
|
||||
$this->executeViewHelper(array(), array(), NULL, NULL, 'FakePlugin');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
namespace FluidTYPO3\Vhs\Tests\Unit\ViewHelpers\Extension\Path;
|
||||
|
||||
/*
|
||||
* This file is part of the FluidTYPO3/Vhs project under GPLv2 or later.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.md file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use FluidTYPO3\Vhs\Tests\Unit\ViewHelpers\AbstractViewHelperTest;
|
||||
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
|
||||
|
||||
/**
|
||||
* @protection on
|
||||
* @author Claus Due <claus@namelesscoder.net>
|
||||
* @package Vhs
|
||||
* @subpackage ViewHelpers\Extension\Path
|
||||
*/
|
||||
class ResourcesViewHelperTest extends AbstractViewHelperTest {
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function rendersUsingArgument() {
|
||||
$test = $this->executeViewHelper(array('extensionName' => 'Vhs', 'path' => 'ext_icon.gif'));
|
||||
$this->assertSame(ExtensionManagementUtility::extRelPath('vhs') . 'Resources/Public/ext_icon.gif', $test);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function rendersUsingControllerContext() {
|
||||
$test = $this->executeViewHelper(array('path' => 'ext_icon.gif'), array(), NULL, 'Vhs');
|
||||
$this->assertSame(ExtensionManagementUtility::extRelPath('vhs') . 'Resources/Public/ext_icon.gif', $test);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function throwsErrorWhenUnableToDetectExtensionName() {
|
||||
$this->setExpectedException('RuntimeException', NULL, 1364167519);
|
||||
$this->executeViewHelper(array(), array(), NULL, NULL, 'FakePlugin');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
namespace FluidTYPO3\Vhs\Tests\Unit\ViewHelpers\Extension\Path;
|
||||
|
||||
/*
|
||||
* This file is part of the FluidTYPO3/Vhs project under GPLv2 or later.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.md file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use FluidTYPO3\Vhs\Tests\Unit\ViewHelpers\AbstractViewHelperTest;
|
||||
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
|
||||
|
||||
/**
|
||||
* @protection on
|
||||
* @author Claus Due <claus@namelesscoder.net>
|
||||
* @package Vhs
|
||||
* @subpackage ViewHelpers\Extension\Path
|
||||
*/
|
||||
class SiteRelativeViewHelperTest extends AbstractViewHelperTest {
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function rendersUsingArgument() {
|
||||
$test = $this->executeViewHelper(array('extensionName' => 'Vhs'));
|
||||
$this->assertSame(ExtensionManagementUtility::siteRelPath('vhs'), $test);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function rendersUsingControllerContext() {
|
||||
$test = $this->executeViewHelper(array(), array(), NULL, 'Vhs');
|
||||
$this->assertSame(ExtensionManagementUtility::siteRelPath('vhs'), $test);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function throwsErrorWhenUnableToDetectExtensionName() {
|
||||
$this->setExpectedException('RuntimeException', NULL, 1364167519);
|
||||
$this->executeViewHelper(array(), array(), NULL, NULL, 'FakePlugin');
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user