<commit_before><?php

Bundle::start('orchestra');

class InstallerRequirementTest extends PHPUnit_Framework_TestCase {
	
	/**
	 * Object stub.
	 *
	 * @var Orchestra\Installer\Requirement
	 */
	protected $stub = null;

	/**
	 * Setup the test environment.
	 */
	public function setUp()
	{
		Session::$instance = null;
		Session::load();

		$this->stub = new Orchestra\Installer\Requirement(
			new Orchestra\Installer\Publisher
		);
	}

	/**
	 * Teardown the test environment.
	 */
	public function tearDown()
	{
		unset($this->stub);
		
		Session::$instance = null;
	}

	/**
	 * Test Orchestra\Installer\Requirement can be constructed.
	 *
	 * @test
	 */
	public function testConstructInstance()
	{
		$this->assertInstanceOf('Orchestra\Installer\Requirement', 
			$this->stub);
	}

	/**
	 * Test Orchestra\Installer\Requirement::installable() return a boolean.
	 *
	 * @test
	 */
	public function testInstallableMethodReturnBoolean()
	{
		$refl = new \ReflectionObject($this->stub);
		$installable = $refl->getProperty('installable');
		$installable->setAccessible(true);

		$this->assertTrue(is_bool($this->stub->installable()));
		$this->assertTrue(is_bool($installable->getValue($this->stub)));
		$this->assertEquals($installable->getValue($this->stub), $this->stub->installable());
	}

	/**
	 * Test Orchestra\Installer\Requirement::checklist() return an array.
	 *
	 * @test
	 */
	public function testChecklistMethodReturnArray()
	{
		$refl = new \ReflectionObject($this->stub);
		$checklist = $refl->getProperty('checklist');
		$checklist->setAccessible(true);

		$this->assertTrue(is_array($this->stub->checklist()));
		$this->assertTrue(is_array($checklist->getValue($this->stub)));
		$this->assertEquals($checklist->getValue($this->stub), $this->stub->checklist());
	}

	/**
	 * Test Orchestra\Installer\Requirement::checklist() method is not 
	 * writable.
	 *
	 * @test
	 */
	public function testChecklistMethodIsNotWritable()
	{
		$mock = $this->getMock('Orchestra\Installer\Publisher', array('publish'));
		$mock->expects($this->any())
			->method('publish')
			->will($this->throwException(new \RuntimeException));

		$stub = new Orchestra\Installer\Requirement($mock);
	}
}<commit_msg>Missing test on Orchestra\Installer\Requirement.<commit_after><?php

Bundle::start('orchestra');

class InstallerRequirementTest extends PHPUnit_Framework_TestCase {
	
	/**
	 * Object stub.
	 *
	 * @var Orchestra\Installer\Requirement
	 */
	protected $stub = null;

	/**
	 * Setup the test environment.
	 */
	public function setUp()
	{
		Session::$instance = null;
		Session::load();

		$this->stub = new Orchestra\Installer\Requirement(
			new Orchestra\Installer\Publisher
		);
	}

	/**
	 * Teardown the test environment.
	 */
	public function tearDown()
	{
		unset($this->stub);
		
		Session::$instance = null;
	}

	/**
	 * Test Orchestra\Installer\Requirement can be constructed.
	 *
	 * @test
	 */
	public function testConstructInstance()
	{
		$this->assertInstanceOf('Orchestra\Installer\Requirement', 
			$this->stub);
	}

	/**
	 * Test Orchestra\Installer\Requirement::installable() return a boolean.
	 *
	 * @test
	 */
	public function testInstallableMethodReturnBoolean()
	{
		$refl = new \ReflectionObject($this->stub);
		$installable = $refl->getProperty('installable');
		$installable->setAccessible(true);

		$this->assertTrue(is_bool($this->stub->installable()));
		$this->assertTrue(is_bool($installable->getValue($this->stub)));
		$this->assertEquals($installable->getValue($this->stub), $this->stub->installable());
	}

	/**
	 * Test Orchestra\Installer\Requirement::checklist() return an array.
	 *
	 * @test
	 */
	public function testChecklistMethodReturnArray()
	{
		$refl = new \ReflectionObject($this->stub);
		$checklist = $refl->getProperty('checklist');
		$checklist->setAccessible(true);

		$this->assertTrue(is_array($this->stub->checklist()));
		$this->assertTrue(is_array($checklist->getValue($this->stub)));
		$this->assertEquals($checklist->getValue($this->stub), $this->stub->checklist());
	}

	/**
	 * Test Orchestra\Installer\Requirement::checklist() method is not 
	 * writable.
	 *
	 * @test
	 */
	public function testChecklistMethodIsNotWritable()
	{
		$mock = $this->getMock('Orchestra\Installer\Publisher', array('publish'));
		$mock->expects($this->any())
			->method('publish')
			->will($this->throwException(new \RuntimeException));

		$stub = new Orchestra\Installer\Requirement($mock);

		$this->assertFalse($stub->installable());
	}
}
{'fraction_non_alphanumeric': 0.17358322177599286, 'fraction_numerical': 0.0, 'mean_word_length': 4.568944099378882, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 81, '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': '1349988', 'n_tokens_mistral': 1511, 'n_tokens_neox': 1412, 'n_words': 218}