<commit_before><?php

namespace Bauhaus\Container;

class ReadableContainerTest extends \PHPUnit_Framework_TestCase
{
    private $container = null;

    protected function setUp()
    {
        $this->container = new FakeReadableContainer($this->readableContainerItems());
    }

    protected function readableContainerItems()
    {
        return [
            'pokemon' => 'Charmander',
            'pirate' => 'Barbossa',
            'music' => 'Right Now',
            'instrument' => 'Bass',
            'follow' => 'The White Rabbit',
        ];
    }

    /**
     * @test
     * @dataProvider namesAndValuesOfExistingItems
     */
    public function verificationThatItemExistsByItsName($itemName)
    {
        $this->assertTrue($this->container->has($itemName));
    }

    /**
     * @test
     * @dataProvider namesAndValuesOfExistingItems
     */
    public function retrieveTheValueOfExistingItemByItsName($itemName, $itemValue)
    {
        $this->assertEquals($itemValue, $this->container->get($itemName));
    }

    /**
     * @test
     * @dataProvider namesAndValuesOfExistingItems
     */
    public function retrieveMagicallyTheValueOfExistingItemByItsName($itemName, $itemValue)
    {
        $this->assertEquals($itemValue, $this->container->{$itemName});
    }

    public function namesAndValuesOfExistingItems()
    {
        $items = $this->readableContainerItems();

        $data = [];
        foreach ($items as $name => $value) {
            $data[] = [$name, $value];
        }

        return $data;
    }

    /**
     * @test
     * @dataProvider namesOfNonExistingItems
     */
    public function verificationThatItemDoesNotExistBySomeName($itemName)
    {
        $this->assertFalse($this->container->has($itemName));
    }

    /**
     * @test
     * @dataProvider namesOfNonExistingItems
     * @expectedException Bauhaus\Container\Exception\ContainerItemNotFoundException
     */
    public function exceptionOccursWhenTryToRetriveNonExistingItem($itemName)
    {
        $this->container->get($itemName);
    }

    /**
     * @test
     * @dataProvider namesOfNonExistingItems
     * @expectedException Bauhaus\Container\Exception\ContainerItemNotFoundException
     */
    public function exceptionOccursWhenTryToRetriveMagicallyNonExistingItem($itemName)
    {
        $this->container->{$itemName};
    }

    public function namesOfNonExistingItems()
    {
        return [
            ['aName'],
            ['anotherName'],
            [''],
            ['bla'],
            ['blu'],
        ];
    }

    /**
     * @test
     */
    public function retrieveAllItemsWhenCallingTheMethodAll()
    {
        $this->assertEquals(
            $this->readableContainerItems(),
            $this->container->all()
        );
    }

    /**
     * @test
     */
    public function retrieveEachItemWhenItIsIterated()
    {
        $outcome = [];
        foreach($this->container as $itemName => $itemValue) {
            $outcome[$itemName] = $itemValue;
        }

        $this->assertEquals($this->readableContainerItems(), $outcome);
    }
}
<commit_msg>Fix the missing space aftar keyword<commit_after><?php

namespace Bauhaus\Container;

class ReadableContainerTest extends \PHPUnit_Framework_TestCase
{
    private $container = null;

    protected function setUp()
    {
        $this->container = new FakeReadableContainer($this->readableContainerItems());
    }

    protected function readableContainerItems()
    {
        return [
            'pokemon' => 'Charmander',
            'pirate' => 'Barbossa',
            'music' => 'Right Now',
            'instrument' => 'Bass',
            'follow' => 'The White Rabbit',
        ];
    }

    /**
     * @test
     * @dataProvider namesAndValuesOfExistingItems
     */
    public function verificationThatItemExistsByItsName($itemName)
    {
        $this->assertTrue($this->container->has($itemName));
    }

    /**
     * @test
     * @dataProvider namesAndValuesOfExistingItems
     */
    public function retrieveTheValueOfExistingItemByItsName($itemName, $itemValue)
    {
        $this->assertEquals($itemValue, $this->container->get($itemName));
    }

    /**
     * @test
     * @dataProvider namesAndValuesOfExistingItems
     */
    public function retrieveMagicallyTheValueOfExistingItemByItsName($itemName, $itemValue)
    {
        $this->assertEquals($itemValue, $this->container->{$itemName});
    }

    public function namesAndValuesOfExistingItems()
    {
        $items = $this->readableContainerItems();

        $data = [];
        foreach ($items as $name => $value) {
            $data[] = [$name, $value];
        }

        return $data;
    }

    /**
     * @test
     * @dataProvider namesOfNonExistingItems
     */
    public function verificationThatItemDoesNotExistBySomeName($itemName)
    {
        $this->assertFalse($this->container->has($itemName));
    }

    /**
     * @test
     * @dataProvider namesOfNonExistingItems
     * @expectedException Bauhaus\Container\Exception\ContainerItemNotFoundException
     */
    public function exceptionOccursWhenTryToRetriveNonExistingItem($itemName)
    {
        $this->container->get($itemName);
    }

    /**
     * @test
     * @dataProvider namesOfNonExistingItems
     * @expectedException Bauhaus\Container\Exception\ContainerItemNotFoundException
     */
    public function exceptionOccursWhenTryToRetriveMagicallyNonExistingItem($itemName)
    {
        $this->container->{$itemName};
    }

    public function namesOfNonExistingItems()
    {
        return [
            ['aName'],
            ['anotherName'],
            [''],
            ['bla'],
            ['blu'],
        ];
    }

    /**
     * @test
     */
    public function retrieveAllItemsWhenCallingTheMethodAll()
    {
        $this->assertEquals(
            $this->readableContainerItems(),
            $this->container->all()
        );
    }

    /**
     * @test
     */
    public function retrieveEachItemWhenItIsIterated()
    {
        $outcome = [];
        foreach ($this->container as $itemName => $itemValue) {
            $outcome[$itemName] = $itemValue;
        }

        $this->assertEquals($this->readableContainerItems(), $outcome);
    }
}

{'fraction_non_alphanumeric': 0.126383319967923, 'fraction_numerical': 0.0, 'mean_word_length': 2.368989735278228, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 69, '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': '2348367', 'n_tokens_mistral': 1772, 'n_tokens_neox': 1721, 'n_words': 260}