acceptance_test.php.svn-base
来自「PHP 知识管理系统(基于树结构的知识管理系统), 英文原版的PHP源码。」· SVN-BASE 代码 · 共 1,633 行 · 第 1/5 页
SVN-BASE
1,633 行
$this->assertTrue($this->setFrameFocus('Protected redirect')); $this->assertResponse(401); $this->assertTrue($this->setFrameFocusByIndex(1)); $this->assertResponse(200); $this->assertText('Simple test front controller'); $this->assertTrue($this->setFrameFocusByIndex(2)); $this->assertResponse(200); $this->assertLink('2'); $this->assertTrue($this->setFrameFocusByIndex(3)); $this->assertResponse(200); $this->assertLink('Set one to 2'); $this->assertTrue($this->setFrameFocusByIndex(4)); $this->assertResponse(200); $this->assertText('Count: 1'); $this->assertTrue($this->setFrameFocusByIndex(5)); $this->assertResponse(200); $this->assertText('r=rrr'); $this->assertTrue($this->setFrameFocusByIndex(6)); $this->assertResponse(401); $this->assertTrue($this->setFrameFocusByIndex(7)); } function testReloadingFramesetPage() { $this->get($this->samples() . 'messy_frameset.html'); $this->assertText('Count: 1'); $this->retry(); $this->assertText('Count: 2'); $this->retry(); $this->assertText('Count: 3'); } function testReloadingSingleFrameWithCookieCounter() { $this->get($this->samples() . 'counting_frameset.html'); $this->setFrameFocus('a'); $this->assertText('Count: 1'); $this->setFrameFocus('b'); $this->assertText('Count: 2'); $this->setFrameFocus('a'); $this->retry(); $this->assertText('Count: 3'); $this->retry(); $this->assertText('Count: 4'); $this->setFrameFocus('b'); $this->assertText('Count: 2'); } function testReloadingFrameWhenUnfocusedReloadsWholeFrameset() { $this->get($this->samples() . 'counting_frameset.html'); $this->setFrameFocus('a'); $this->assertText('Count: 1'); $this->setFrameFocus('b'); $this->assertText('Count: 2'); $this->clearFrameFocus('a'); $this->retry(); $this->assertTitle('Frameset for testing of SimpleTest'); $this->setFrameFocus('a'); $this->assertText('Count: 3'); $this->setFrameFocus('b'); $this->assertText('Count: 4'); } function testClickingNormalLinkReplacesJustThatFrame() { $this->get($this->samples() . 'messy_frameset.html'); $this->clickLink('2'); $this->assertLink('3'); $this->assertText('Simple test front controller'); } function testJumpToNamedPageReplacesJustThatFrame() { $this->get($this->samples() . 'messy_frameset.html'); $this->assertPattern('/Simple test front controller/'); $this->clickLink('Index'); $this->assertResponse(200); $this->assertText('[action=index]'); $this->assertText('Count: 1'); } function testJumpToUnnamedPageReplacesJustThatFrame() { $this->get($this->samples() . 'messy_frameset.html'); $this->clickLink('No page'); $this->assertResponse(200); $this->assertText('Simple test front controller'); $this->assertText('[action=no_page]'); $this->assertText('Count: 1'); } function testJumpToUnnamedPageWithBareParameterReplacesJustThatFrame() { $this->get($this->samples() . 'messy_frameset.html'); $this->clickLink('Bare action'); $this->assertResponse(200); $this->assertText('Simple test front controller'); $this->assertText('[action=]'); $this->assertText('Count: 1'); } function testJumpToUnnamedPageWithEmptyQueryReplacesJustThatFrame() { $this->get($this->samples() . 'messy_frameset.html'); $this->clickLink('Empty query'); $this->assertResponse(200); $this->assertPattern('/Simple test front controller/'); $this->assertPattern('/raw get data.*?\[\].*?get data/si'); $this->assertPattern('/Count: 1/'); } function testJumpToUnnamedPageWithEmptyLinkReplacesJustThatFrame() { $this->get($this->samples() . 'messy_frameset.html'); $this->clickLink('Empty link'); $this->assertResponse(200); $this->assertPattern('/Simple test front controller/'); $this->assertPattern('/raw get data.*?\[\].*?get data/si'); $this->assertPattern('/Count: 1/'); } function testJumpBackADirectoryLevelReplacesJustThatFrame() { $this->get($this->samples() . 'messy_frameset.html'); $this->clickLink('Down one'); $this->assertPattern('/index of .*\/test/i'); $this->assertPattern('/Count: 1/'); } function testSubmitToNamedPageReplacesJustThatFrame() { $this->get($this->samples() . 'messy_frameset.html'); $this->assertPattern('/Simple test front controller/'); $this->clickSubmit('Index'); $this->assertResponse(200); $this->assertText('[action=Index]'); $this->assertText('Count: 1'); } function testSubmitToSameDirectoryReplacesJustThatFrame() { $this->get($this->samples() . 'messy_frameset.html'); $this->clickSubmit('Same directory'); $this->assertResponse(200); $this->assertText('[action=Same+directory]'); $this->assertText('Count: 1'); } function testSubmitToEmptyActionReplacesJustThatFrame() { $this->get($this->samples() . 'messy_frameset.html'); $this->clickSubmit('Empty action'); $this->assertResponse(200); $this->assertText('[action=Empty+action]'); $this->assertText('Count: 1'); } function testSubmitToNoActionReplacesJustThatFrame() { $this->get($this->samples() . 'messy_frameset.html'); $this->clickSubmit('No action'); $this->assertResponse(200); $this->assertText('[action=No+action]'); $this->assertText('Count: 1'); } function testSubmitBackADirectoryLevelReplacesJustThatFrame() { $this->get($this->samples() . 'messy_frameset.html'); $this->clickSubmit('Down one'); $this->assertPattern('/index of .*\/test/i'); $this->assertPattern('/Count: 1/'); } function testTopLinkExitsFrameset() { $this->get($this->samples() . 'messy_frameset.html'); $this->clickLink('Exit the frameset'); $this->assertTitle('Simple test target file'); } function testLinkInOnePageCanLoadAnother() { $this->get($this->samples() . 'messy_frameset.html'); $this->assertNoLink('3'); $this->clickLink('Set one to 2'); $this->assertLink('3'); $this->assertNoLink('2'); $this->assertTitle('Frameset for testing of SimpleTest'); } function testFrameWithRelativeLinksRespectsBaseTagForThatPage() { $this->get($this->samples() . 'base_tag/frameset.html'); $this->click('Back to test pages'); $this->assertTitle('Frameset for testing of SimpleTest'); $this->assertText('A target for the SimpleTest test suite'); } function testRelativeLinkInFrameIsNotAffectedByFramesetBaseTag() { $this->get($this->samples() . 'base_tag/frameset_with_base_tag.html'); $this->assertText('This is page 1'); $this->click('To page 2'); $this->assertTitle('Frameset for testing of SimpleTest'); $this->assertText('This is page 2'); }}class TestOfFrameAuthentication extends SimpleTestAcceptanceTest { function setUp() { $this->addHeader('User-Agent: SimpleTest ' . SimpleTest::getVersion()); } function testUnauthenticatedFrameSendsChallenge() { $this->get($this->samples() . 'protected/'); $this->setFrameFocus('Protected'); $this->assertAuthentication('Basic'); $this->assertRealm('SimpleTest basic authentication'); $this->assertResponse(401); } function testCanReadFrameFromAlreadyAuthenticatedRealm() { $this->get($this->samples() . 'protected/'); $this->authenticate('test', 'secret'); $this->get($this->samples() . 'messy_frameset.html'); $this->setFrameFocus('Protected'); $this->assertResponse(200); $this->assertText('A target for the SimpleTest test suite'); } function testCanAuthenticateFrame() { $this->get($this->samples() . 'messy_frameset.html'); $this->setFrameFocus('Protected'); $this->authenticate('test', 'secret'); $this->assertResponse(200); $this->assertText('A target for the SimpleTest test suite'); $this->clearFrameFocus(); $this->assertText('Count: 1'); } function testCanAuthenticateRedirectedFrame() { $this->get($this->samples() . 'messy_frameset.html'); $this->setFrameFocus('Protected redirect'); $this->assertResponse(401); $this->authenticate('test', 'secret'); $this->assertResponse(200); $this->assertText('A target for the SimpleTest test suite'); $this->clearFrameFocus(); $this->assertText('Count: 1'); }}class TestOfNestedFrames extends SimpleTestAcceptanceTest { function setUp() { $this->addHeader('User-Agent: SimpleTest ' . SimpleTest::getVersion()); } function testCanNavigateToSpecificContent() { $this->get($this->samples() . 'nested_frameset.html'); $this->assertTitle('Nested frameset for testing of SimpleTest'); $this->assertPattern('/This is frame A/'); $this->assertPattern('/This is frame B/'); $this->assertPattern('/Simple test front controller/'); $this->assertLink('2'); $this->assertLink('Set one to 2'); $this->assertPattern('/Count: 1/'); $this->assertPattern('/r=rrr/'); $this->setFrameFocus('pair'); $this->assertPattern('/This is frame A/'); $this->assertPattern('/This is frame B/'); $this->assertNoPattern('/Simple test front controller/'); $this->assertNoLink('2'); $this->setFrameFocus('aaa'); $this->assertPattern('/This is frame A/'); $this->assertNoPattern('/This is frame B/'); $this->clearFrameFocus(); $this->assertResponse(200); $this->setFrameFocus('messy'); $this->assertResponse(200); $this->setFrameFocus('Front controller'); $this->assertResponse(200); $this->assertPattern('/Simple test front controller/'); $this->assertNoLink('2'); } function testReloadingFramesetPage() { $this->get($this->samples() . 'nested_frameset.html'); $this->assertPattern('/Count: 1/'); $this->retry(); $this->assertPattern('/Count: 2/'); $this->retry(); $this->assertPattern('/Count: 3/'); } function testRetryingNestedPageOnlyRetriesThatSet() { $this->get($this->samples() . 'nested_frameset.html'); $this->assertPattern('/Count: 1/'); $this->setFrameFocus('messy'); $this->retry(); $this->assertPattern('/Count: 2/'); $this->setFrameFocus('Counter'); $this->retry(); $this->assertPattern('/Count: 3/'); $this->clearFrameFocus(); $this->setFrameFocus('messy'); $this->setFrameFocus('Front controller'); $this->retry(); $this->clearFrameFocus(); $this->assertPattern('/Count: 3/'); } function testAuthenticatingNestedPage() { $this->get($this->samples() . 'nested_frameset.html'); $this->setFrameFocus('messy'); $this->setFrameFocus('Protected'); $this->assertAuthentication('Basic'); $this->assertRealm('SimpleTest basic authentication'); $this->assertResponse(401); $this->authenticate('test', 'secret'); $this->assertResponse(200); $this->assertPattern('/A target for the SimpleTest test suite/'); }}?>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?