<commit_before><?php

namespace JMS\Tests\ObjectRouting\Symfony;

use JMS\ObjectRouting\Symfony\Symfony22Adapter;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;

class Symfony22AdapterTest extends \PHPUnit_Framework_TestCase
{
    /** @var Symfony22Adapter */
    private $adapter;
    private $router;

    public function testGenerate()
    {
        $this->router->expects($this->once())
            ->method('generate')
            ->with('foo', array('bar' => 'baz'), UrlGeneratorInterface::ABSOLUTE_URL)
            ->will($this->returnValue('/foo-bar-baz'));

        $this->assertEquals('/foo-bar-baz', $this->adapter->generate('foo', array('bar' => 'baz'), true));
    }

    protected function setUp()
    {
        $this->adapter = new Symfony22Adapter(
            $this->router = $this->getMock('Symfony\Component\Routing\RouterInterface')
        );
    }
}<commit_msg>Skipp Symfony22AdapterTest if UrlGeneratorInterface::ABSOLUTE_URL is not defined.<commit_after><?php

namespace JMS\Tests\ObjectRouting\Symfony;

use JMS\ObjectRouting\Symfony\Symfony22Adapter;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;

class Symfony22AdapterTest extends \PHPUnit_Framework_TestCase
{
    /** @var Symfony22Adapter */
    private $adapter;
    private $router;

    public function testGenerate()
    {
        if(!defined('Symfony\Component\Routing\Generator\UrlGeneratorInterface::ABSOLUTE_URL')){
            $this->markTestSkipped('Skipping this test because required constant UrlGeneratorInterface::ABSOLUTE_URL is not defined.');
        }
        $this->router->expects($this->once())
            ->method('generate')
            ->with('foo', array('bar' => 'baz'), UrlGeneratorInterface::ABSOLUTE_URL)
            ->will($this->returnValue('/foo-bar-baz'));

        $this->assertEquals('/foo-bar-baz', $this->adapter->generate('foo', array('bar' => 'baz'), true));
    }

    protected function setUp()
    {
        $this->adapter = new Symfony22Adapter(
            $this->router = $this->getMock('Symfony\Component\Routing\RouterInterface')
        );
    }
}
{'fraction_non_alphanumeric': 0.14841156946420103, 'fraction_numerical': 0.008534850640113799, 'mean_word_length': 3.4703389830508473, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 34, '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': '3226783', 'n_tokens_mistral': 623, 'n_tokens_neox': 607, 'n_words': 97}