<commit_before><?php

Bundle::start('orchestra');

class ControllerTest extends PHPUnit_Framework_TestCase {

	/**
	 * Setup the test environment.
	 */
	public function setUp()
	{
		$_SERVER['test.orchestra.started'] = null;
		$_SERVER['test.orchestra.done'] = null;
	}

	/**
	 * Teardown the test environment.
	 */
	public function tearDown()
	{
		unset($_SERVER['test.orchestra.started']);
		unset($_SERVER['test.orchestra.done']);
	}

	/**
	 * Test Orchestra\Controller::__construct()
	 *
	 * @test
	 */
	public function testFilter()
	{
		$controller = new Orchestra\Controller;

		$this->assertTrue(\View::$shared['fluent_layout']);
		$this->assertEquals(Orchestra\Core::memory(),
			\View::$shared['orchestra_memory']);
	}

	/**
	 * Test Orchestra\Controller::__construct() triggers `orchestra.started: backend`
	 *
	 * @test
	 */
	public function testConstructTriggerEvents()
	{
		Event::listen('orchestra.started: backend', function()
		{
			$_SERVER['test.orchestra.started'] = 'foo';
		});

		$controller = new Orchestra\Controller;

		$this->assertEquals('foo', $_SERVER['test.orchestra.started']);
	}

	/**
	 * Test Orchestra\Controller::after() triggers `orchestra.done: backend`
	 *
	 * @test
	 */
	public function testAfterTriggerEvent()
	{
		Event::listen('orchestra.done: backend', function()
		{
			$_SERVER['test.orchestra.done'] = 'foo';
		});

		$controller = with(new Orchestra\Controller)->after('foobar');

		$this->assertEquals('foo', $_SERVER['test.orchestra.done']);
	}
}<commit_msg>Assert before and after event occur<commit_after><?php

Bundle::start('orchestra');

class ControllerTest extends PHPUnit_Framework_TestCase {

	/**
	 * Setup the test environment.
	 */
	public function setUp()
	{
		$_SERVER['test.orchestra.started'] = null;
		$_SERVER['test.orchestra.done'] = null;
	}

	/**
	 * Teardown the test environment.
	 */
	public function tearDown()
	{
		unset($_SERVER['test.orchestra.started']);
		unset($_SERVER['test.orchestra.done']);
	}

	/**
	 * Test Orchestra\Controller::__construct()
	 *
	 * @test
	 */
	public function testFilter()
	{
		$controller = new Orchestra\Controller;

		$this->assertTrue(\View::$shared['fluent_layout']);
		$this->assertEquals(Orchestra\Core::memory(),
			\View::$shared['orchestra_memory']);
	}

	/**
	 * Test Orchestra\Controller::__construct() triggers `orchestra.started: backend`
	 *
	 * @test
	 */
	public function testConstructTriggerEvents()
	{
		Event::listen('orchestra.started: backend', function()
		{
			$_SERVER['test.orchestra.started'] = 'foo';
		});

		$this->assertTrue(is_null($_SERVER['test.orchestra.started']));

		$controller = new Orchestra\Controller;

		$this->assertEquals('foo', $_SERVER['test.orchestra.started']);
	}

	/**
	 * Test Orchestra\Controller::after() triggers `orchestra.done: backend`
	 *
	 * @test
	 */
	public function testAfterTriggerEvent()
	{
		Event::listen('orchestra.done: backend', function()
		{
			$_SERVER['test.orchestra.done'] = 'foo';
		});

		$this->assertTrue(is_null($_SERVER['test.orchestra.done']));

		$controller = with(new Orchestra\Controller)->after('foobar');

		$this->assertEquals('foo', $_SERVER['test.orchestra.done']);
	}
}
{'fraction_non_alphanumeric': 0.18101545253863136, 'fraction_numerical': 0.0, 'mean_word_length': 4.624113475177305, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 15, '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': '6115934', 'n_tokens_mistral': 1083, 'n_tokens_neox': 1002, 'n_words': 159}