<commit_before><?php

namespace OpenOrchestra\DisplayBundle\Test\Manager;

use OpenOrchestra\DisplayBundle\Manager\CacheableManager;
use Phake;

/**
 * Test CacheableManagerTest
 */
class CacheableManagerTest extends \PHPUnit_Framework_TestCase
{
    /**
     * @var CacheableManager
     */
    protected $manager;

    /**
     * Set up the test
     */
    public function setUp()
    {
        $this->manager = new CacheableManager();
    }

    /**
     * @param int $maxAge
     * @param int $expectedMaxAge
     * @param int $count
     *
     * @dataProvider provideMaxAgeAndCount
     */
    public function testSetMaxAge($maxAge, $expectedMaxAge, $count = 1)
    {
        $response = Phake::mock('Symfony\Component\HttpFoundation\Response');

        $newResponse = $this->manager->setMaxAge($maxAge, $response);

        $this->assertSame($response, $newResponse);
        Phake::verify($newResponse, Phake::times($count))->setMaxAge($expectedMaxAge);
    }

    /**
     * @return array
     */
    public function provideMaxAgeAndCount()
    {
        return array(
            array(1, 1),
            array(1000, 1000),
            array(5, 5),
            array(0, Phake::anyParameters(), 0),
            array(-1, 2629743),
        );
    }
}
<commit_msg>Fix CacheableManager broken tests<commit_after><?php

namespace OpenOrchestra\DisplayBundle\Test\Manager;

use OpenOrchestra\DisplayBundle\Manager\CacheableManager;
use Phake;

/**
 * Test CacheableManagerTest
 */
class CacheableManagerTest extends \PHPUnit_Framework_TestCase
{
    /**
     * @var CacheableManager
     */
    protected $manager;

    /**
     * Set up the test
     */
    public function setUp()
    {
        $this->manager = new CacheableManager();
    }

    /**
     * @param int $maxAge
     * @param int $expectedMaxAge
     * @param int count
     *
     * @dataProvider provideMaxAge
     */
    public function testSetPublicResponseCacheParameters($maxAge, $expectedMaxAge, $count)
    {
        $response = Phake::mock('Symfony\Component\HttpFoundation\Response');

        $newResponse = $this->manager->setResponseCacheParameters($response, $maxAge, 'public');

        $this->assertSame($response, $newResponse);
        Phake::verify($newResponse)->setPublic();
        Phake::verify($newResponse, Phake::times($count))->setMaxAge($expectedMaxAge);
        Phake::verify($newResponse, Phake::times($count))->setSharedMaxAge($expectedMaxAge);
    }

    /**
     * @param int $maxAge
     * @param int $expectedMaxAge
     *
     * @dataProvider provideMaxAge
     */
    public function testSetPrivateResponseCacheParameters($maxAge, $expectedMaxAge, $count)
    {
        $response = Phake::mock('Symfony\Component\HttpFoundation\Response');

        $newResponse = $this->manager->setResponseCacheParameters($response, $maxAge, 'private');

        $this->assertSame($response, $newResponse);
        Phake::verify($newResponse)->setPrivate();
        Phake::verify($newResponse, Phake::times($count))->setMaxAge($expectedMaxAge);
    }

    /**
     * @return array
     */
    public function provideMaxAge()
    {
        return array(
            array(300, 300, 1),
            array(-1, 2629743, 1),
            array(0, 0, 0)
        );
    }
}

{'fraction_non_alphanumeric': 0.1343146274149034, 'fraction_numerical': 0.012879484820607176, 'mean_word_length': 2.7580645161290325, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 20, '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': '4817812', 'n_tokens_mistral': 1011, 'n_tokens_neox': 943, 'n_words': 170}