MOON
Server: Apache
System: Linux res.emeff.ca 3.10.0-962.3.2.lve1.5.24.10.el7.x86_64 #1 SMP Wed Mar 20 07:36:02 EDT 2019 x86_64
User: accemeff (1004)
PHP: 7.0.33
Disabled: NONE
Upload Files
File: /home/accemeff/vendor/craftcms/cms/tests/unit/ViewTest.php
<?php

class ViewTest extends \Codeception\Test\Unit
{
    /**
     * @var \UnitTester
     */

    // tests
    public function testNormalizeObjectTemplate()
    {
        $view = Craft::$app->view;

        $this->assertEquals('{{ object.titleWithHyphens|replace({\'-\': \'!\'}) }}', $view->normalizeObjectTemplate('{{ object.titleWithHyphens|replace({\'-\': \'!\'}) }}'));
        $this->assertEquals('{{ (_variables.foo ?? object.foo)|raw }}', $view->normalizeObjectTemplate('{foo}'));
        $this->assertEquals('{{ (_variables.foo ?? object.foo).bar|raw }}', $view->normalizeObjectTemplate('{foo.bar}'));
        $this->assertEquals('{foo : \'bar\'}', $view->normalizeObjectTemplate('{foo : \'bar\'}'));
        $this->assertEquals('{{foo}}', $view->normalizeObjectTemplate('{{foo}}'));
        $this->assertEquals('{% foo %}', $view->normalizeObjectTemplate('{% foo %}'));
        $this->assertEquals('{{ (_variables.foo ?? object.foo).fn({bar: baz})|raw }}', $view->normalizeObjectTemplate('{foo.fn({bar: baz})}'));
        $this->assertEquals('{{ (_variables.foo ?? object.foo).fn({bar: {baz: 1}})|raw }}', $view->normalizeObjectTemplate('{foo.fn({bar: {baz: 1}})}'));
        $this->assertEquals('{{ (_variables.foo ?? object.foo).fn(\'bar:baz\')|raw }}', $view->normalizeObjectTemplate('{foo.fn(\'bar:baz\')}'));
        $this->assertEquals('{{ (_variables.foo ?? object.foo).fn({\'bar\': baz})|raw }}', $view->normalizeObjectTemplate('{foo.fn({\'bar\': baz})}'));
    }
}