<commit_before><?php
/**
 * This file is part of bovigo\callmap.
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 *
 * @package  bovigo_callmap
 */
namespace bovigo\callmap;
/**
 * Tests for call mapping with a list of return values.
 */
class InvocationResultsTest extends \PHPUnit_Framework_TestCase
{
    /**
     * @type  bovigo\callmap\Proxy
     */
    private $proxy;

    /**
     * set up test environment
     */
    public function setUp()
    {
        $this->proxy = NewInstance::of('\ReflectionObject', [$this]);
    }

    /**
     * @test
     */
    public function mapToInvocationResultsReturnsResultOnMethodCall()
    {
        $this->proxy->mapCalls(
            ['getName' => new InvocationResults(['foo', 'bar', 'baz'])]
        );
        foreach (['foo', 'bar', 'baz'] as $expected) {
            assertEquals($expected, $this->proxy->getName());
        }
    }

    /**
     * @test
     */
    public function invocationResultIsNullIfCalledMoreOftenThenResultsDefined()
    {
        $this->proxy->mapCalls(['getName' => new InvocationResults([])]);
        assertNull($this->proxy->getName());
    }<commit_msg>introduce more clarity through a variable<commit_after><?php
/**
 * This file is part of bovigo\callmap.
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 *
 * @package  bovigo_callmap
 */
namespace bovigo\callmap;
/**
 * Tests for call mapping with a list of return values.
 */
class InvocationResultsTest extends \PHPUnit_Framework_TestCase
{
    /**
     * @type  bovigo\callmap\Proxy
     */
    private $proxy;

    /**
     * set up test environment
     */
    public function setUp()
    {
        $this->proxy = NewInstance::of('\ReflectionObject', [$this]);
    }

    /**
     * @test
     */
    public function mapToInvocationResultsReturnsResultOnMethodCall()
    {
        $returnValues = ['foo', 'bar', 'baz'];
        $this->proxy->mapCalls(
            ['getName' => new InvocationResults($returnValues)]
        );
        foreach ($returnValues as $expected) {
            assertEquals($expected, $this->proxy->getName());
        }
    }

    /**
     * @test
     */
    public function invocationResultIsNullIfCalledMoreOftenThenResultsDefined()
    {
        $this->proxy->mapCalls(['getName' => new InvocationResults([])]);
        assertNull($this->proxy->getName());
    }
{'fraction_non_alphanumeric': 0.13554578168732506, 'fraction_numerical': 0.0, 'mean_word_length': 2.6103896103896105, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 25, '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': '4137844', 'n_tokens_mistral': 713, 'n_tokens_neox': 701, 'n_words': 173}