Improve test coverage.
This commit is contained in:
@@ -0,0 +1,44 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of Mustache.php.
|
||||||
|
*
|
||||||
|
* (c) 2013 Justin Hileman
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
class Mustache_Test_Cache_AbstractCacheTest extends PHPUnit_Framework_TestCase
|
||||||
|
{
|
||||||
|
public function testGetSetLogger()
|
||||||
|
{
|
||||||
|
$cache = new CacheStub();
|
||||||
|
$logger = new Mustache_Logger_StreamLogger('php://stdout');
|
||||||
|
$cache->setLogger($logger);
|
||||||
|
$this->assertSame($logger, $cache->getLogger());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @expectedException Mustache_Exception_InvalidArgumentException
|
||||||
|
*/
|
||||||
|
public function testSetLoggerThrowsExceptions()
|
||||||
|
{
|
||||||
|
$cache = new CacheStub();
|
||||||
|
$logger = new StdClass();
|
||||||
|
$cache->setLogger($logger);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class CacheStub extends Mustache_Cache_AbstractCache
|
||||||
|
{
|
||||||
|
public function load($key)
|
||||||
|
{
|
||||||
|
// nada
|
||||||
|
}
|
||||||
|
|
||||||
|
public function cache($key, $value)
|
||||||
|
{
|
||||||
|
// nada
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -45,6 +45,7 @@ class Mustache_Test_EngineTest extends PHPUnit_Framework_TestCase
|
|||||||
'bar' => 'BAR',
|
'bar' => 'BAR',
|
||||||
),
|
),
|
||||||
'escape' => 'strtoupper',
|
'escape' => 'strtoupper',
|
||||||
|
'entity_flags' => ENT_QUOTES,
|
||||||
'charset' => 'ISO-8859-1',
|
'charset' => 'ISO-8859-1',
|
||||||
));
|
));
|
||||||
|
|
||||||
@@ -54,6 +55,7 @@ class Mustache_Test_EngineTest extends PHPUnit_Framework_TestCase
|
|||||||
$this->assertEquals('{{ foo }}', $partialsLoader->load('foo'));
|
$this->assertEquals('{{ foo }}', $partialsLoader->load('foo'));
|
||||||
$this->assertContains('__whot__', $mustache->getTemplateClassName('{{ foo }}'));
|
$this->assertContains('__whot__', $mustache->getTemplateClassName('{{ foo }}'));
|
||||||
$this->assertEquals('strtoupper', $mustache->getEscape());
|
$this->assertEquals('strtoupper', $mustache->getEscape());
|
||||||
|
$this->assertEquals(ENT_QUOTES, $mustache->getEntityFlags());
|
||||||
$this->assertEquals('ISO-8859-1', $mustache->getCharset());
|
$this->assertEquals('ISO-8859-1', $mustache->getCharset());
|
||||||
$this->assertTrue($mustache->hasHelper('foo'));
|
$this->assertTrue($mustache->hasHelper('foo'));
|
||||||
$this->assertTrue($mustache->hasHelper('bar'));
|
$this->assertTrue($mustache->hasHelper('bar'));
|
||||||
|
|||||||
Reference in New Issue
Block a user