<commit_before><?php

/*
 * This file is part of the Sonata package.
 *
 * (c) <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Sonata\DoctrinePHPCRAdminBundle\Tests\Filter;

use Sonata\DoctrinePHPCRAdminBundle\Route\PathInfoBuilderSlashes;
use Sonata\AdminBundle\Translator\LabelTranslatorStrategyInterface;

//No idea why, phpunit crashes when mocking Admin if this is not present.
//Maybe some autoload problem?
class phpunitfix implements LabelTranslatorStrategyInterface
{
    public function getLabel($label, $context = '', $type = ''){
        return "ho";
    }
}
class PathInfoBuilderSlashesTest extends \PHPUnit_Framework_TestCase
{
    function testBuild()
    {
        $collectionChild = $this->getMock('Sonata\AdminBundle\Route\RouteCollection', array(), array(), '', false);

        $adminChild = $this->getMock('Sonata\AdminBundle\Admin\Admin', array(), array(), '', false);
        $adminChild->expects($this->once())
            ->method('getRoutes')
            ->will($this->returnValue($collectionChild));

        $admin = $this->getMock('Sonata\AdminBundle\Admin\Admin', array(), array(), '', false);
        $admin->expects($this->once())
            ->method('getChildren')
            ->will($this->returnValue(array($adminChild)));

        $collection = $this->getMock('Sonata\AdminBundle\Route\RouteCollection', array(), array(), '', false);
        $collection->expects($this->once())
            ->method('addCollection')
            ->with($this->anything());
        $collection->expects($this->exactly(6))
            ->method('add')
            ->with($this->anything());

        $builder = new PathInfoBuilderSlashes();
        $builder->build($admin, $collection);
    }<commit_msg>Fixed test as per https://github.com/sonata-project/SonataAdminBundle/pull/417<commit_after><?php

/*
 * This file is part of the Sonata package.
 *
 * (c) <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Sonata\DoctrinePHPCRAdminBundle\Tests\Filter;

use Sonata\DoctrinePHPCRAdminBundle\Route\PathInfoBuilderSlashes;
use Sonata\AdminBundle\Translator\LabelTranslatorStrategyInterface;

class PathInfoBuilderSlashesTest extends \PHPUnit_Framework_TestCase
{
    function testBuild()
    {
        $collectionChild = $this->getMock('Sonata\\AdminBundle\\Route\\RouteCollection', array(), array(), '', false);

        //$adminChild = $this->getMock('Sonata\\AdminBundle\\Admin\\Admin', array(), array(), '', false);
        $adminChild = $this->getMockBuilder('Sonata\\AdminBundle\\Admin\\Admin')->disableOriginalConstructor()->getMock();
        $adminChild->expects($this->once())
            ->method('getRoutes')
            ->will($this->returnValue($collectionChild));

        $admin = $this->getMockBuilder('Sonata\\AdminBundle\\Admin\\Admin')->disableOriginalConstructor()->getMock();
        $admin->expects($this->once())
            ->method('getChildren')
            ->will($this->returnValue(array($adminChild)));

        $collection = $this->getMock('Sonata\\AdminBundle\\Route\\RouteCollection', array(), array(), '', false);
        $collection->expects($this->once())
            ->method('addCollection')
            ->with($this->anything());
        $collection->expects($this->exactly(6))
            ->method('add')
            ->with($this->anything());

        $builder = new PathInfoBuilderSlashes();
        $builder->build($admin, $collection);
    }
{'fraction_non_alphanumeric': 0.1621174524400331, 'fraction_numerical': 0.0013785497656465398, 'mean_word_length': 3.4956629491945477, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 64, 'https://': 1, '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': '4811917', 'n_tokens_mistral': 1007, 'n_tokens_neox': 981, 'n_words': 191}