예제 #1
0
 public function testGetSetBasePath()
 {
     $helper = new AssetsHelper();
     $helper->setBasePath('foo/');
     $this->assertEquals($helper->getBasePath(), '/foo/', '->setBasePath() prepends a / if needed');
     $helper->setBasePath('/foo');
     $this->assertEquals($helper->getBasePath(), '/foo/', '->setBasePath() appends a / is needed');
     $helper->setBasePath('');
     $this->assertEquals($helper->getBasePath(), '/', '->setBasePath() returns / if no base path is defined');
     $helper->setBasePath('0');
     $this->assertEquals($helper->getBasePath(), '/0/', '->setBasePath() returns /0/ if 0 is given');
 }
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
require_once __DIR__ . '/../../../../bootstrap.php';
use Symfony\Components\Templating\Helper\AssetsHelper;
$t = new LimeTest(25);
// __construct()
$t->diag('__construct()');
$helper = new AssetsHelper('foo', 'http://www.example.com', 'abcd');
$t->is($helper->getBasePath(), '/foo/', '__construct() takes a base path as its first argument');
$t->is($helper->getBaseURLs(), array('http://www.example.com'), '__construct() takes a base URL as its second argument');
$t->is($helper->getVersion(), 'abcd', '__construct() takes a version as its thrid argument');
// ->getBasePath() ->setBasePath()
$t->diag('->getBasePath() ->setBasePath()');
$helper = new AssetsHelper();
$helper->setBasePath('foo/');
$t->is($helper->getBasePath(), '/foo/', '->setBasePath() prepends a / if needed');
$helper->setBasePath('/foo');
$t->is($helper->getBasePath(), '/foo/', '->setBasePath() appends a / is needed');
$helper->setBasePath('');
$t->is($helper->getBasePath(), '/', '->setBasePath() returns / if no base path is defined');
$helper->setBasePath('0');
$t->is($helper->getBasePath(), '/0/', '->setBasePath() returns /0/ if 0 is given');
// ->getVersion() ->getVersion()
$t->diag('->getVersion() ->getVersion()');
$helper = new AssetsHelper();
$helper->setVersion('foo');
$t->is($helper->getVersion(), 'foo', '->setVersion() sets the version');
// ->setBaseURLs() ->getBaseURLs()
$t->diag('->setBaseURLs() ->getBaseURLs()');
$helper = new AssetsHelper();