Improve test coverage.

This commit is contained in:
Justin Hileman
2013-12-14 12:50:51 -08:00
parent 3a9a8bde36
commit a467124a46
2 changed files with 46 additions and 0 deletions
@@ -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
}
}
+2
View File
@@ -45,6 +45,7 @@ class Mustache_Test_EngineTest extends PHPUnit_Framework_TestCase
'bar' => 'BAR',
),
'escape' => 'strtoupper',
'entity_flags' => ENT_QUOTES,
'charset' => 'ISO-8859-1',
));
@@ -54,6 +55,7 @@ class Mustache_Test_EngineTest extends PHPUnit_Framework_TestCase
$this->assertEquals('{{ foo }}', $partialsLoader->load('foo'));
$this->assertContains('__whot__', $mustache->getTemplateClassName('{{ foo }}'));
$this->assertEquals('strtoupper', $mustache->getEscape());
$this->assertEquals(ENT_QUOTES, $mustache->getEntityFlags());
$this->assertEquals('ISO-8859-1', $mustache->getCharset());
$this->assertTrue($mustache->hasHelper('foo'));
$this->assertTrue($mustache->hasHelper('bar'));