本文整理匯總了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);
}