<commit_before><?php
use Darya\Service\Container;

class ContainerTest extends PHPUnit_Framework_TestCase {
	
	protected function assertSomething(Something $something) {
		$this->assertInstanceOf('Something', $something);
		$this->assertInstanceOf('AnotherThing', $something->another);
		$this->assertInstanceOf('SomethingElse', $something->else);
		$this->assertInstanceOf('SomethingElse', $something->another->else);
	}
	
	public function testCreate() {
		$container = new Container;
		
		$something = $container->create('Something');
		
		$this->assertSomething($something);
	}
	
	public function testCall() {
		$container = new Container;
		
		$closure = function (Something $something) {
			return $something;
		};
		
		$something = $container->call($closure);
		
		$this->assertSomething($something);
	}
	
	public function testCallDefaultValue() {
		$container = new Container;
		
		$closure = function (Something $something, $value = 'default') {
			return array($something, $value);
		};
		
		list($something, $value) = $container->call($closure);
		
		$this->assertSomething($something);
		$this->assertEquals('default', $value);
	}
	
	public function testCallArgs() {
		$container = new Container;
		
		$closure = function ($one, $two = 'two', $three = 'three') {
			return func_get_args();
		};
		
		list($one, $two, $three) = $container->call($closure);
		
		$this->assertNull($one);
		$this->assertEquals('two', $two);
		$this->assertEquals('three', $three);
		
		$result = $container->call($closure, array(
			'three', 2, 'one'
		));
		
		$this->assertEquals(array('three', 2, 'one'), $result);
		
		$result = $container->call($closure, array(
			'three' => 1,
			'two' => 2,
			'one' => 3
		));
		
		$this->assertEquals(array(3, 2, 1), $result);
	}<commit_msg>Changed a container test slightly.<commit_after><?php
use Darya\Service\Container;

class ContainerTest extends PHPUnit_Framework_TestCase {
	
	protected function assertSomething(Something $something) {
		$this->assertInstanceOf('Something', $something);
		$this->assertInstanceOf('AnotherThing', $something->another);
		$this->assertInstanceOf('SomethingElse', $something->else);
		$this->assertInstanceOf('SomethingElse', $something->another->else);
	}
	
	public function testCreate() {
		$container = new Container;
		
		$something = $container->create('Something');
		
		$this->assertSomething($something);
	}
	
	public function testCall() {
		$container = new Container;
		
		$closure = function (Something $something) {
			return $something;
		};
		
		$something = $container->call($closure);
		
		$this->assertSomething($something);
	}
	
	public function testCallDefaultValue() {
		$container = new Container;
		
		$closure = function (Something $something, $value = 'default') {
			return array($something, $value);
		};
		
		list($something, $value) = $container->call($closure);
		
		$this->assertSomething($something);
		$this->assertEquals('default', $value);
	}
	
	public function testCallArgs() {
		$container = new Container;
		
		$closure = function ($one, $two = 'two', $three = 'three') {
			return func_get_args();
		};
		
		$result = $container->call($closure);
		
		$this->assertEquals(array(null, 'two', 'three'), $result);
		
		$result = $container->call($closure, array(
			'three', 2, 'one'
		));
		
		$this->assertEquals(array('three', 2, 'one'), $result);
		
		$result = $container->call($closure, array(
			'three' => 1,
			'two' => 2,
			'one' => 3
		));
		
		$this->assertEquals(array(3, 2, 1), $result);
	}
{'fraction_non_alphanumeric': 0.17596810933940774, 'fraction_numerical': 0.004555808656036446, 'mean_word_length': 4.480499219968799, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 53, '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': '5155291', 'n_tokens_mistral': 1247, 'n_tokens_neox': 1029, 'n_words': 223}