<commit_before><?php
/******************************************************************************
 * php-src - A library that handles creation of objects and management of 
 * global services to help you refactor your legacy code base
 *
 * Copyright (c) 2014, 2015 <NAME> <<EMAIL>>
 *
 * This software is licensed under The MIT License. You should have received 
 * a copy of the along with the code.
 */

class Foo {
    public $a = null;
    public $b = null;
    public function __construct($a, $b) {
        $this->a = $a;
        $this->b = $b;
    }
}

class SrcBuildTest extends PHPUnit_Framework_TestCase {
    public function setUp() {
        $src = new Lechimp\Src\Src();
        $this->src = $src
        ->constructorFor("Foo", function($src, $a, $b) {
            return new Foo($a, $b);
        });
    }

    public function testConstruct() {
        $inst = $this->src->construct("Foo", "a", "b");
        $this->assertInstanceOf("Foo", $inst);
    }

    public function testParams() {
        $inst = $this->src->construct("Foo", "a", "b");
        $this->assertEquals("a", $inst->a);
        $this->assertEquals("b", $inst->b);
    }

    public function testConstructsFreshInstances() {
        $inst1 = $this->src->construct("Foo", "a", "b");
        $inst2 = $this->src->construct("Foo", "a", "b");
        $this->assertNotSame($inst1, $inst2);
    }

    /**
     * @expectedException Lechimp\Src\Exceptions\UnknownClass
     */
    public function testUnknownClass() {
        $this->src->construct("Bar");
    }<commit_msg>added test on passing of Src<commit_after><?php
/******************************************************************************
 * php-src - A library that handles creation of objects and management of 
 * global services to help you refactor your legacy code base
 *
 * Copyright (c) 2014, 2015 <NAME> <<EMAIL>>
 *
 * This software is licensed under The MIT License. You should have received 
 * a copy of the along with the code.
 */

class Foo {
    public $a = null;
    public $b = null;
    public function __construct($a, $b) {
        $this->a = $a;
        $this->b = $b;
    }
}

class SrcBuildTest extends PHPUnit_Framework_TestCase {
    public function setUp() {
        $src = new Lechimp\Src\Src();
        $this->src = $src
        ->constructorFor("Foo", function($src, $a, $b) {
            return new Foo($a, $b);
        });
    }

    public function testConstruct() {
        $inst = $this->src->construct("Foo", "a", "b");
        $this->assertInstanceOf("Foo", $inst);
    }

    public function testParams() {
        $inst = $this->src->construct("Foo", "a", "b");
        $this->assertEquals("a", $inst->a);
        $this->assertEquals("b", $inst->b);
    }

    public function testConstructsFreshInstances() {
        $inst1 = $this->src->construct("Foo", "a", "b");
        $inst2 = $this->src->construct("Foo", "a", "b");
        $this->assertNotSame($inst1, $inst2);
    }

    public function testPassesSrc() {
        $tmp = array();
        $src = $this->src
        ->constructorFor("Bar", function($src) use (&$tmp) {
            $this->assertSame($src, $tmp["src"]);
        });
        $tmp["src"] = $src; 

        $src->construct("Bar");
    }

    /**
     * @expectedException Lechimp\Src\Exceptions\UnknownClass
     */
    public function testUnknownClass() {
        $this->src->construct("Bar");
    }
{'fraction_non_alphanumeric': 0.2081740664510438, 'fraction_numerical': 0.007056748015289621, 'mean_word_length': 2.6580645161290324, 'pattern_counts': {'":': 0, '<': 11, '<?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': '7558911', 'n_tokens_mistral': 1058, 'n_tokens_neox': 1001, 'n_words': 267}