Skip to content

Commit

Permalink
Added tests
Browse files Browse the repository at this point in the history
  • Loading branch information
boekkooi committed Jul 24, 2014
1 parent 5697324 commit 2078bf5
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/BoekkooiTwigJackBundleTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php
namespace Tests\Boekkooi\Bundle\TwigJackBundle;

use Boekkooi\Bundle\TwigJackBundle\BoekkooiTwigJackBundle;

/**
* @author Warnar Boekkooi <warnar@boekkooi.net>
*/
class BoekkooiTwigJackBundleTest extends \PHPUnit_Framework_TestCase
{
public function testName()
{
$bundle = new BoekkooiTwigJackBundle();
$this->assertEquals('BoekkooiTwigJackBundle', $bundle->getName());
}
}
22 changes: 22 additions & 0 deletions tests/Twig/Extension/DeferExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ protected function tearDown()
$this->extension = null;
}

public function testGetters()
{
$this->assertCount(1, $this->extension->getTokenParsers());
$this->assertCount(1, $this->extension->getFunctions());
$this->assertEquals('defer', $this->extension->getName());
}

public function testCacheAndRetrieve()
{
$this->extension->cache('a', 'c', 'a');
Expand Down Expand Up @@ -66,4 +73,19 @@ public function testRetrieveKeep()
$resSame = $this->extension->retrieve('a');
$this->assertEquals($res, $resSame);
}

public function testContains()
{
$this->assertFalse($this->extension->contains('type', 'name'));
$this->assertFalse($this->extension->contains('type', 'fake_name'));
$this->assertFalse($this->extension->contains('fake_type', 'name'));
$this->assertFalse($this->extension->contains('fake_type', 'fake_name'));

$this->extension->cache('type', 'content', 'name');

$this->assertTrue($this->extension->contains('type', 'name'));
$this->assertFalse($this->extension->contains('type', 'fake_name'));
$this->assertFalse($this->extension->contains('fake_type', 'name'));
$this->assertFalse($this->extension->contains('fake_type', 'fake_name'));
}
}

0 comments on commit 2078bf5

Please sign in to comment.