handlebars.php-helpers/tests/HelpersTest.php

58 lines
1.9 KiB
PHP
Raw Normal View History

2014-12-12 17:47:27 +03:00
<?php
/*
* This file is part of Handlebars.php Helpers Set
*
* (c) Dmitriy Simushev <simushevds@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace JustBlackBird\HandlebarsHelpers\Tests;
use JustBlackBird\HandlebarsHelpers\Helpers;
/**
* Test class for Global Helpers Set.
*
* @author Dmitriy Simushev <simushevds@gmail.com>
*/
class HelpersTest extends \PHPUnit_Framework_TestCase
{
/**
* Tests that all helpers in the set exist and have valid classes.
*
* @dataProvider helpersProvider
*/
public function testHelper($name, $class)
{
$helpers = new Helpers();
$this->assertTrue($helpers->has($name), sprintf('There is no "%s" helper', $name));
$this->assertInstanceOf($class, $helpers->{$name});
}
/**
* A data provider for testHelper method.
*/
public function helpersProvider()
{
return array(
// Date helpers
array('formatDate', '\\JustBlackBird\\HandlebarsHelpers\\Date\\FormatDateHelper'),
// Comparison helpers
2014-12-15 13:52:46 +03:00
array('ifAny', '\\JustBlackBird\\HandlebarsHelpers\\Comparison\\IfAnyHelper'),
2014-12-12 17:47:27 +03:00
array('ifEqual', '\\JustBlackBird\\HandlebarsHelpers\\Comparison\\IfEqualHelper'),
array('ifEven', '\\JustBlackBird\\HandlebarsHelpers\\Comparison\\IfEvenHelper'),
array('ifOdd', '\\JustBlackBird\\HandlebarsHelpers\\Comparison\\IfOddHelper'),
array('unlessEqual', '\\JustBlackBird\\HandlebarsHelpers\\Comparison\\UnlessEqualHelper'),
2014-12-15 12:38:49 +03:00
// String helpers
array('lowercase', '\\JustBlackBird\\HandlebarsHelpers\\String\\LowercaseHelper'),
2014-12-15 12:50:18 +03:00
array('uppercase', '\\JustBlackBird\\HandlebarsHelpers\\String\\UppercaseHelper'),
2014-12-15 13:19:04 +03:00
array('repeat', '\\JustBlackBird\\HandlebarsHelpers\\String\\RepeatHelper'),
2014-12-12 17:47:27 +03:00
);
}
}