Nestable\Tests\Services\NestableServiceTest::testActive PHP Метод

testActive() публичный Метод

public testActive ( )
    public function testActive()
    {
        $nestable = new \Nestable\Services\NestableService();
        $nested = $nestable->make($this->categories);
        $html = $nested->active('sweaters')->renderAsHtml();
        $this->assertRegExp('/\\<li\\s+?class=\\"active\\"\\><a\\s+?href=\\".*\\/sweaters\\"\\>Sweaters\\<\\/a\\>/', $html);
        $html = $nested->active('sweaters', 'black-sweaters')->renderAsHtml();
        $this->assertRegExp('/\\<li\\s+?class=\\"active\\"\\><a\\s+?href=\\".*\\/sweaters\\"\\>Sweaters\\<\\/a\\>/', $html);
        $html = $nested->active(['sweaters'])->renderAsHtml();
        $this->assertRegExp('/\\<li\\s+?class=\\"active\\"\\><a\\s+?href=\\".*\\/sweaters\\"\\>Sweaters\\<\\/a\\>/', $html);
        $html = $nested->active(function ($li, $href, $label) {
            $li->addAttr('data-label', 'label');
        })->renderAsHtml();
        $this->assertRegExp('/\\<li\\s+?data\\-label=\\"label\\"\\><a\\s+?href=\\".*\\/sweaters\\"\\>Sweaters\\<\\/a\\>/', $html);
    }