<commit_before><?php
/**
 * Webino (http://webino.sk)
 *
 * @link        https://github.com/webino/WebinoCanonicalRedirect for the canonical source repository
 * @copyright   Copyright (c) 2013 Webino, s. r. o. (http://webino.sk)
 * @author      <NAME> <<EMAIL>>
 * @license     New BSD License
 */

namespace WebinoCanonicalRedirect;

use Zend\Mvc\MvcEvent;

/**
 * Generated by PHPUnit on 2013-02-16 at 12:59:36.
 */
class ModuleTest extends \PHPUnit_Framework_TestCase
{
    /**
     * @var Module
     */
    protected $object;

    /**
     * @var \PHPUnit_Framework_MockObject_MockObject
     */
    protected $canonicalizer;

    /**
     * @var \PHPUnit_Framework_MockObject_MockObject
     */
    protected $event;

    /**
     * @var \PHPUnit_Framework_MockObject_MockObject
     */
    protected $events;

    /**
     * @var \PHPUnit_Framework_MockObject_MockObject
     */
    protected $options;

    /**
     * @var \PHPUnit_Framework_MockObject_MockObject
     */
    protected $request;

    /**
     * Sets up the fixture, for example, opens a network connection.
     * This method is called before a test is executed.
     */
    protected function setUp()
    {
        $this->object = new Module;

        $app = $this->getMock('Zend\Mvc\Application', array(), array(), '', false);
        $this->canonicalizer = $this->getMock(
            'WebinoCanonicalRedirect\Uri\Canonicalizer',
            array(),
            array(),
            '',
            false
        );
        $this->event   = $this->getMock('Zend\Mvc\MvcEvent');
        $this->events  = $this->getMock('Zend\EventManager\EventManager');
        $this->options = $this->getMock('WebinoCanonicalRedirect\Options\ModuleOptions');
        $this->request = $this->getMock('Zend\Http\Request');
        $services      = $this->getMock('Zend\ServiceManager\ServiceManager');

        $this->event->expects($this->any())
            ->method('getApplication')
            ->will($this->returnValue($app));

        $app->expects($this->any())
            ->method('getServiceManager')
            ->will($this->returnValue($services));

        $app->expects($this->any())
            ->method('getEventManager')
            ->will($this->returnValue($this->events));

        $testCase = $this; // TODO PHP 5.4
        $services->expects($this->any())
            ->method('get')
            ->will(
                $this->returnCallback(
                    function ($serviceName) use ($testCase) {
                        switch ($serviceName) {

                            case 'WebinoCanonicalRedirect\Options\ModuleOptions':
                                return $testCase->options;

                            case 'WebinoCanonicalRedirect\Uri\Canonicalizer':
                                return $testCase->canonicalizer;

                            default:
                                $testCase->fail('Unexpected service ' . $serviceName);
                        }
                    }
                )
            );

        $this->options->expects($this->any())
            ->method('useWww')
            ->will($this->returnValue(true));

        $this->options->expects($this->any())
            ->method('useSlash')
            ->will($this->returnValue(true));
    }

    /**
     * Tears down the fixture, for example, closes a network connection.
     * This method is called after a test is executed.
     */
    protected function tearDown()<commit_msg>Fixed ModuleTest for PHP 5.3<commit_after><?php
/**
 * Webino (http://webino.sk)
 *
 * @link        https://github.com/webino/WebinoCanonicalRedirect for the canonical source repository
 * @copyright   Copyright (c) 2013 Webino, s. r. o. (http://webino.sk)
 * @author      <NAME> <<EMAIL>>
 * @license     New BSD License
 */

namespace WebinoCanonicalRedirect;

use Zend\Mvc\MvcEvent;

/**
 * Generated by PHPUnit on 2013-02-16 at 12:59:36.
 */
class ModuleTest extends \PHPUnit_Framework_TestCase
{
    /**
     * @var Module
     */
    protected $object;

    /**
     * @var \PHPUnit_Framework_MockObject_MockObject
     */
    protected $canonicalizer;

    /**
     * @var \PHPUnit_Framework_MockObject_MockObject
     */
    protected $event;

    /**
     * @var \PHPUnit_Framework_MockObject_MockObject
     */
    protected $events;

    /**
     * @var \PHPUnit_Framework_MockObject_MockObject
     */
    protected $options;

    /**
     * @var \PHPUnit_Framework_MockObject_MockObject
     */
    protected $request;

    /**
     * Sets up the fixture, for example, opens a network connection.
     * This method is called before a test is executed.
     */
    protected function setUp()
    {
        $this->object = new Module;

        $app = $this->getMock('Zend\Mvc\Application', array(), array(), '', false);
        $this->canonicalizer = $this->getMock(
            'WebinoCanonicalRedirect\Uri\Canonicalizer',
            array(),
            array(),
            '',
            false
        );
        $this->event   = $this->getMock('Zend\Mvc\MvcEvent');
        $this->events  = $this->getMock('Zend\EventManager\EventManager');
        $this->options = $this->getMock('WebinoCanonicalRedirect\Options\ModuleOptions');
        $this->request = $this->getMock('Zend\Http\Request');
        $services      = $this->getMock('Zend\ServiceManager\ServiceManager');

        $this->event->expects($this->any())
            ->method('getApplication')
            ->will($this->returnValue($app));

        $app->expects($this->any())
            ->method('getServiceManager')
            ->will($this->returnValue($services));

        $app->expects($this->any())
            ->method('getEventManager')
            ->will($this->returnValue($this->events));

        $options       = $this->options; // TODO PHP 5.4
        $canonicalizer = $this->canonicalizer; // TODO PHP 5.4
        $testCase      = $this; // TODO PHP 5.4
        $services->expects($this->any())
            ->method('get')
            ->will(
                $this->returnCallback(
                    function ($serviceName) use ($options, $canonicalizer, $testCase) {
                        switch ($serviceName) {

                            case 'WebinoCanonicalRedirect\Options\ModuleOptions':
                                return $options;

                            case 'WebinoCanonicalRedirect\Uri\Canonicalizer':
                                return $canonicalizer;

                            default:
                                $testCase->fail('Unexpected service ' . $serviceName);
                        }
                    }
                )
            );

        $this->options->expects($this->any())
            ->method('useWww')
            ->will($this->returnValue(true));

        $this->options->expects($this->any())
            ->method('useSlash')
            ->will($this->returnValue(true));
    }

    /**
     * Tears down the fixture, for example, closes a network connection.
     * This method is called after a test is executed.
     */
    protected function tearDown()
{'fraction_non_alphanumeric': 0.14046210200056353, 'fraction_numerical': 0.006480698788391096, 'mean_word_length': 1.8521494576134994, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 109, 'https://': 2, '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': '5516157', 'n_tokens_mistral': 1993, 'n_tokens_neox': 1906, 'n_words': 365}