<commit_before><?php

/*
* This file is part of Spoon Library.
*
* (c) <NAME> <<EMAIL>>
*
* For the full copyright and license information, please view the license
* file that was distributed with this source code.
*/

namespace Spoon\Template\Tests;
use Spoon\Template\Autoloader;
use Spoon\Template\Template;
use Spoon\Template\Environment;

require_once realpath(dirname(__FILE__) . '/../') . '/Autoloader.php';
require_once 'PHPUnit/Framework/TestCase.php';

class TemplateTest extends \PHPUnit_Framework_TestCase
{
	/**
	 * @var Spoon\Template\Template
	 */
	protected  $template;

	protected function setUp()
	{
		Autoloader::register();
		$this->template = new Template(new Environment());
	}

	protected function tearDown()
	{
		$this->template = null;
	}

	public function testAssign()
	{
		// strings
		$this->template->assign('key', 'value');
		$this->assertEquals('value', $this->template->get('key'));

		// arrays
		$this->template->assign(array('foo' => 'bar'));
		$this->assertEquals('bar', $this->template->get('foo'));

		// objects
		$object = new \stdClass();
		$object->name = 'Template';
		$object->email = '<EMAIL>';
		$this->template->assign($object);
		$this->assertEquals($object->email, $this->template->get('email'));
		$this->template->assign('person', $object);
		$this->assertEquals($object, $this->template->get('person'));

		$this->assertSame($this->template, $this->template->assign('key', 'value'));
	}

	public function testGet()
	{
		$this->template->assign('name', '<NAME>');
		$this->assertEquals('<NAME>', $this->template->get('name'));
	}

	public function testRemove()
	{
		$this->template->assign('name', '<NAME>');
		$this->template->remove('name');
		$this->assertEquals(null, $this->template->get('name'));

		$this->template->assign('name', '<NAME>');
		$this->assertSame($this->template, $this->template->remove('name'));
	}
}<commit_msg>Adds test to trigger exception in the render method.<commit_after><?php

/*
* This file is part of Spoon Library.
*
* (c) <NAME> <<EMAIL>>
*
* For the full copyright and license information, please view the license
* file that was distributed with this source code.
*/

namespace Spoon\Template\Tests;
use Spoon\Template\Autoloader;
use Spoon\Template\Template;
use Spoon\Template\Environment;

require_once realpath(dirname(__FILE__) . '/../') . '/Autoloader.php';
require_once 'PHPUnit/Framework/TestCase.php';

class TemplateTest extends \PHPUnit_Framework_TestCase
{
	/**
	 * @var Spoon\Template\Template
	 */
	protected  $template;

	protected function setUp()
	{
		Autoloader::register();
		$this->template = new Template(new Environment());
	}

	protected function tearDown()
	{
		$this->template = null;
	}

	public function testAssign()
	{
		// strings
		$this->template->assign('key', 'value');
		$this->assertEquals('value', $this->template->get('key'));

		// arrays
		$this->template->assign(array('foo' => 'bar'));
		$this->assertEquals('bar', $this->template->get('foo'));

		// objects
		$object = new \stdClass();
		$object->name = 'Template';
		$object->email = '<EMAIL>';
		$this->template->assign($object);
		$this->assertEquals($object->email, $this->template->get('email'));
		$this->template->assign('person', $object);
		$this->assertEquals($object, $this->template->get('person'));

		$this->assertSame($this->template, $this->template->assign('key', 'value'));
	}

	public function testGet()
	{
		$this->template->assign('name', '<NAME>');
		$this->assertEquals('<NAME>', $this->template->get('name'));
	}

	public function testRemove()
	{
		$this->template->assign('name', '<NAME>');
		$this->template->remove('name');
		$this->assertEquals(null, $this->template->get('name'));

		$this->template->assign('name', '<NAME>');
		$this->assertSame($this->template, $this->template->remove('name'));
	}

	/**
	 * @expectedException Spoon\Template\Exception
	 */
	public function testRenderException()
	{
		$this->template->render('foo-bar-baz.tpl');
	}
}
{'fraction_non_alphanumeric': 0.20666161998485996, 'fraction_numerical': 0.0, 'mean_word_length': 4.907600596125186, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 117, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4973283', 'n_tokens_mistral': 1314, 'n_tokens_neox': 1240, 'n_words': 242}