本文整理汇总了PHP中SimpleUrl::setTarget方法的典型用法代码示例。如果您正苦于以下问题:PHP SimpleUrl::setTarget方法的具体用法?PHP SimpleUrl::setTarget怎么用?PHP SimpleUrl::setTarget使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SimpleUrl
的用法示例。
在下文中一共展示了SimpleUrl::setTarget方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testDefaultFrameTargetOnForm
function testDefaultFrameTargetOnForm()
{
$tag = new SimpleFormTag(array('method' => 'GET', 'action' => 'here.php', 'id' => '33'));
$form = new SimpleForm($tag, new SimpleUrl('http://host/a/index.html'));
$form->setDefaultTarget('frame');
$expected = new SimpleUrl('http://host/a/here.php');
$expected->setTarget('frame');
$this->assertEqual($form->getAction(), $expected);
}
示例2: testDefaultFrameTargetOnForm
function testDefaultFrameTargetOnForm()
{
$page =& new MockSimplePage();
$page->expectOnce('expandUrl', array(new SimpleUrl('here.php')));
$page->setReturnValue('expandUrl', new SimpleUrl('http://host/here.php'));
$tag =& new SimpleFormTag(array('method' => 'GET', 'action' => 'here.php'));
$form =& new SimpleForm($tag, $page);
$form->setDefaultTarget('frame');
$expected = new SimpleUrl('http://host/here.php');
$expected->setTarget('frame');
$this->assertEqual($form->getAction(), $expected);
}
示例3: MockSimpleUserAgent
function testClickLinkWithUnknownFrameStillRequestsWholePage()
{
$agent = new MockSimpleUserAgent();
$agent->returns('fetchResponse', new MockSimpleHttpResponse());
$agent->expectAt(0, 'fetchResponse', array(new SimpleUrl('http://this.com/page.html'), new SimpleGetEncoding()));
$target = new SimpleUrl('http://this.com/new.html');
$target->setTarget('missing');
$agent->expectAt(1, 'fetchResponse', array($target, new SimpleGetEncoding()));
$agent->expectCallCount('fetchResponse', 2);
$parsed_url = new SimpleUrl('http://this.com/new.html');
$parsed_url->setTarget('missing');
$page = new MockSimplePage();
$page->setReturnValue('getUrlsByLabel', array($parsed_url));
$page->setReturnValue('hasFrames', false);
$page->expectOnce('getUrlsByLabel', array('New'));
$page->setReturnValue('getRaw', 'A page');
$browser = $this->createBrowser($agent, $page);
$browser->get('http://this.com/page.html');
$this->assertTrue($browser->clickLink('New'));
}
示例4: testTargetAttachment
function testTargetAttachment()
{
$url = new SimpleUrl('http://www.site.com/home.html');
$this->assertIdentical($url->getTarget(), false);
$url->setTarget('A frame');
$this->assertIdentical($url->getTarget(), 'A frame');
}
示例5: testReadFrameTaggedUrlsFromFrameInFocus
function testReadFrameTaggedUrlsFromFrameInFocus()
{
$frame =& new MockSimplePage();
$by_label = new SimpleUrl('l');
$by_label->setTarget('L');
$frame->setReturnValue('getUrlsByLabel', array($by_label));
$by_id = new SimpleUrl('i');
$by_id->setTarget('I');
$frame->setReturnValue('getUrlById', $by_id);
$frameset =& new SimpleFrameset(new MockSimplePage());
$frameset->addFrame($frame, 'A');
$frameset->setFrameFocus('A');
$this->assertIdentical($frameset->getUrlsByLabel('label'), array($by_label));
$this->assertIdentical($frameset->getUrlById(99), $by_id);
}