lithium\tests\cases\template\helper\HtmlTest::testScopeOption PHP Method

testScopeOption() public method

public testScopeOption ( )
    public function testScopeOption()
    {
        $result = array();
        $this->context = new MockRenderer(array('request' => new Request(array('base' => '', 'host' => 'foo.local')), 'response' => new Response(), 'handlers' => array('url' => function ($url, $ref, array $options = array()) use(&$result) {
            $result = compact('options');
        }, 'path' => function ($path, $ref, array $options = array()) use(&$result) {
            $result = compact('options');
        })));
        $this->html = new Html(array('context' => &$this->context));
        $this->html->link('home', '/home');
        $this->assertFalse(isset($result['options']['scope']));
        $this->html->link('home', '/home', array('scope' => 'app'));
        $this->assertEqual('app', $result['options']['scope']);
        $this->html->link('RSS Feed', array('controller' => 'posts', 'type' => 'rss'), array('type' => 'rss'));
        $this->assertFalse(isset($result['options']['scope']));
        $this->html->link('RSS Feed', array('controller' => 'posts', 'type' => 'rss'), array('type' => 'rss', 'scope' => 'app'));
        $this->assertEqual('app', $result['options']['scope']);
        $this->html->script('script.js');
        $this->assertFalse(isset($result['options']['scope']));
        $this->html->script('script.js', array('scope' => 'app'));
        $this->assertEqual('app', $result['options']['scope']);
        $this->html->image('test.gif');
        $this->assertFalse(isset($result['options']['scope']));
        $this->html->image('test.gif', array('scope' => 'app'));
        $this->assertEqual('app', $result['options']['scope']);
        $this->html->style('screen');
        $this->assertFalse(isset($result['options']['scope']));
        $this->html->style('screen', array('scope' => 'app'));
        $this->assertEqual('app', $result['options']['scope']);
        $this->html->link('home', '/home');
        $this->assertFalse(isset($result['options']['scope']));
        $expected = array('app' => array('domain' => 'bob'));
        $this->html->link('home', '/home', array('scope' => $expected));
        $this->assertEqual($expected, $result['options']['scope']);
    }