<commit_before><?php

namespace Oro\Bundle\AsseticBundle\Tests\Unit\Twig;

use \Twig_Token;
use \Twig_TokenStream;
use Oro\Bundle\AsseticBundle\Twig\AsseticTokenParser;

class AsseticTokenParserTest extends \PHPUnit_Framework_TestCase
{
    /**
     * @var \PHPUnit_Framework_MockObject_MockObject
     */
    private $assetsConfiguration;

    /**
     * @var \PHPUnit_Framework_MockObject_MockObject
     */
    private $assetFactory;

    /**
     * @var AsseticTokenParser
     */
    private $parser;

    /**
     * @var string
     */
    private $tagName = 'oro_css';

    /**
     * @var string
     */
    private $output = 'css/*.css';

    protected function setUp()
    {
        $this->assetsConfiguration = $this->getMockBuilder('Oro\Bundle\AsseticBundle\AssetsConfiguration')
            ->disableOriginalConstructor()
            ->getMock();

        $this->assetFactory = $this->getMockBuilder('Symfony\Bundle\AsseticBundle\Factory\AssetFactory')
            ->disableOriginalConstructor()
            ->getMock();

        $this->tagName = 'oro_css';

        $this->parser = new AsseticTokenParser(
            $this->assetsConfiguration,
            $this->assetFactory,
            $this->tagName,
            $this->output
        );
    }

    public function testGetTag()
    {
        $this->assertEquals($this->tagName, $this->parser->getTag());
    }

    public function testTestEndTag()
    {
        $token = new Twig_Token(Twig_Token::NAME_TYPE, 'end' . $this->tagName, 31);
        $this->assertTrue($this->parser->testEndTag($token));
    }

    public function testParse()
    {
        $parser = $this->getMockBuilder('Twig_Parser')
            ->disableOriginalConstructor()
            ->getMock();

        $startToken = new Twig_Token(Twig_Token::NAME_TYPE, 'oro_css', 31);

        $stream = new Twig_TokenStream(
            array(
                new Twig_Token(Twig_Token::NAME_TYPE, 'filter', 31),
                new Twig_Token(Twig_Token::OPERATOR_TYPE, '=', 31),
                new Twig_Token(Twig_Token::STRING_TYPE, 'cssrewrite, lessphp, ?cssmin', 31),
                new Twig_Token(Twig_Token::NAME_TYPE, 'debug', 31),
                new Twig_Token(Twig_Token::OPERATOR_TYPE, '=', 31),
                new Twig_Token(Twig_Token::NAME_TYPE, 'false', 31),
                new Twig_Token(Twig_Token::NAME_TYPE, 'combine', 31),
                new Twig_Token(Twig_Token::OPERATOR_TYPE, '=', 31),
                new Twig_Token(Twig_Token::NAME_TYPE, 'false', 31),
                new Twig_Token(Twig_Token::NAME_TYPE, 'output', 31),
                new Twig_Token(Twig_Token::OPERATOR_TYPE, '=', 31),<commit_msg>BAP-15961: Add SCSS support to OroPlatform - Fix tests<commit_after><?php

namespace Oro\Bundle\AsseticBundle\Tests\Unit\Twig;

use \Twig_Token;
use \Twig_TokenStream;
use Oro\Bundle\AsseticBundle\Twig\AsseticTokenParser;

class AsseticTokenParserTest extends \PHPUnit_Framework_TestCase
{
    /**
     * @var \PHPUnit_Framework_MockObject_MockObject
     */
    private $assetsConfiguration;

    /**
     * @var \PHPUnit_Framework_MockObject_MockObject
     */
    private $assetFactory;

    /**
     * @var AsseticTokenParser
     */
    private $parser;

    /**
     * @var string
     */
    private $tagName = 'oro_css';

    /**
     * @var string
     */
    private $output = 'css/*.css';

    protected function setUp()
    {
        $this->assetsConfiguration = $this->getMockBuilder('Oro\Bundle\AsseticBundle\AssetsConfiguration')
            ->disableOriginalConstructor()
            ->getMock();

        $this->assetFactory = $this->getMockBuilder('Symfony\Bundle\AsseticBundle\Factory\AssetFactory')
            ->disableOriginalConstructor()
            ->getMock();

        $this->tagName = 'oro_css';

        $this->parser = new AsseticTokenParser(
            $this->assetsConfiguration,
            $this->assetFactory,
            $this->tagName,
            $this->output
        );
    }

    public function testGetTag()
    {
        $this->assertEquals($this->tagName, $this->parser->getTag());
    }

    public function testTestEndTag()
    {
        $token = new Twig_Token(Twig_Token::NAME_TYPE, 'end' . $this->tagName, 31);
        $this->assertTrue($this->parser->testEndTag($token));
    }

    public function testParse()
    {
        $parser = $this->getMockBuilder('Twig_Parser')
            ->disableOriginalConstructor()
            ->getMock();

        $startToken = new Twig_Token(Twig_Token::NAME_TYPE, 'oro_css', 31);

        $stream = new Twig_TokenStream(
            array(
                new Twig_Token(Twig_Token::NAME_TYPE, 'filter', 31),
                new Twig_Token(Twig_Token::OPERATOR_TYPE, '=', 31),
                new Twig_Token(Twig_Token::STRING_TYPE, 'cssrewrite, scssphp, ?cssmin', 31),
                new Twig_Token(Twig_Token::NAME_TYPE, 'debug', 31),
                new Twig_Token(Twig_Token::OPERATOR_TYPE, '=', 31),
                new Twig_Token(Twig_Token::NAME_TYPE, 'false', 31),
                new Twig_Token(Twig_Token::NAME_TYPE, 'combine', 31),
                new Twig_Token(Twig_Token::OPERATOR_TYPE, '=', 31),
                new Twig_Token(Twig_Token::NAME_TYPE, 'false', 31),
                new Twig_Token(Twig_Token::NAME_TYPE, 'output', 31),
                new Twig_Token(Twig_Token::OPERATOR_TYPE, '=', 31),
{'fraction_non_alphanumeric': 0.1324762437115707, 'fraction_numerical': 0.010620458356623811, 'mean_word_length': 2.4565357372826786, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 53, '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': '7060990', 'n_tokens_mistral': 1733, 'n_tokens_neox': 1627, 'n_words': 262}