<commit_before><?php

Bundle::start('orchestra');

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

		// before we can manually test Orchestra\Core::start()
		// we need to shutdown Orchestra first.
		Orchestra\Core::shutdown();
	}

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

	/**
	 * Test Orchestra\Core::start() is properly done.
	 *
	 * @test
	 */
	public function testStartTriggerEvents()
	{
		Event::listen('orchestra.started', function ()
		{
			$_SERVER['test.orchestra.started'] = 'foo';
		});

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

		Orchestra\Core::start();

		$memory = Orchestra\Core::memory();
		$menu   = Orchestra\Core::menu();

		$this->assertNotNull($memory);
		$this->assertInstanceOf('Hybrid\Memory\Driver', $memory);

		$this->assertNotNull($menu);
		$this->assertInstanceOf('Orchestra\Widget\Menu', $menu);
	
		$this->assertEquals('foo', $_SERVER['test.orchestra.started']);

		Orchestra\Core::shutdown();
	}

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

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

		Orchestra\Core::start();
		Orchestra\Core::shutdown();

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

	/**
	 * Test validity of Orchestra\Core helpers
	 *
	 * @test
	 */
	public function testValidityOfHelpers()
	{
		Orchestra\Core::start();

		$expected = Orchestra\Widget::make('menu.orchestra');
		$this->assertEquals($expected, Orchestra\Core::menu());
		$this->assertInstanceOf('Orchestra\Widget\Driver', Orchestra\Core::menu());

		$expected = Orchestra\Widget::make('menu.application');
		$this->assertEquals($expected, Orchestra\Core::menu('app'));
		$this->assertInstanceOf('Orchestra\Widget\Driver', Orchestra\Core::menu('app'));

		$this->assertInstanceOf('Hybrid\Memory\Driver', Orchestra\Core::memory());
		$this->assertInstanceOf('Hybrid\Acl\Container', Orchestra\Core::acl());

		Orchestra\Core::shutdown();
	}

	/**
	 * Test Roles search is properly configured.
	 *
	 * @test
	 */
	public function testRolesSearchIsProperlyConfigured()
	{
		Orchestra\Core::start();
		
		$this->assertTrue(is_callable(Config::get('hybrid::auth.roles')));

		Orchestra\Core::shutdown();
	}
}<commit_msg>Some other assertion<commit_after><?php

Bundle::start('orchestra');

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

		// before we can manually test Orchestra\Core::start()
		// we need to shutdown Orchestra first.
		Orchestra\Core::shutdown();
	}

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

	/**
	 * Test Orchestra\Core::start() is properly done.
	 *
	 * @test
	 */
	public function testStartTriggerEvents()
	{
		Event::listen('orchestra.started', function ()
		{
			$_SERVER['test.orchestra.started'] = 'foo';
		});

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

		Orchestra\Core::start();

		$memory = Orchestra\Core::memory();
		$menu   = Orchestra\Core::menu();

		$this->assertNotNull($memory);
		$this->assertInstanceOf('Hybrid\Memory\Driver', $memory);

		$this->assertNotNull($menu);
		$this->assertInstanceOf('Orchestra\Widget\Menu', $menu);
	
		$this->assertEquals('foo', $_SERVER['test.orchestra.started']);

		Orchestra\Core::shutdown();
	}

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

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

		Orchestra\Core::start();
		Orchestra\Core::shutdown();

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

	/**
	 * Test validity of Orchestra\Core helpers
	 *
	 * @test
	 */
	public function testValidityOfHelpers()
	{
		Orchestra\Core::start();

		$expected = Orchestra\Widget::make('menu.orchestra');
		$this->assertEquals($expected, Orchestra\Core::menu());
		$this->assertInstanceOf('Orchestra\Widget\Driver', Orchestra\Core::menu());

		$expected = Orchestra\Widget::make('menu.application');
		$this->assertEquals($expected, Orchestra\Core::menu('app'));
		$this->assertInstanceOf('Orchestra\Widget\Driver', Orchestra\Core::menu('app'));

		$this->assertInstanceOf('Hybrid\Memory\Driver', Orchestra\Core::memory());
		$this->assertInstanceOf('Hybrid\Acl\Container', Orchestra\Core::acl());

		Orchestra\Core::shutdown();
	}

	/**
	 * Test Configuration is properly configured.
	 *
	 * @test
	 */
	public function testConfigurationIsProperlyConfigured()
	{
		Orchestra\Core::start();

		$memory = Orchestra\Core::memory();
		
		$this->assertTrue(is_callable(Config::get('hybrid::auth.roles')));
		$this->assertTrue(is_array(Config::get('hybrid.form.fieldset')));
		$this->assertFalse(empty($memory->get('site.theme.backend')));
		$this->assertFalse(empty($memory->get('site.theme.frontend')));
		$this->assertTrue(IoC::registered('orchestra.theme: backend'));
		$this->assertTrue(IoC::registered('orchestra.theme: frontend'));

		Orchestra\Core::shutdown();
	}
}
{'fraction_non_alphanumeric': 0.19122531026044398, 'fraction_numerical': 0.0, 'mean_word_length': 4.979101358411703, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 40, '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': '1636587', 'n_tokens_mistral': 1976, 'n_tokens_neox': 1832, 'n_words': 258}