acceptance_test.php.svn-base
来自「PHP 知识管理系统(基于树结构的知识管理系统), 英文原版的PHP源码。」· SVN-BASE 代码 · 共 1,633 行 · 第 1/5 页
SVN-BASE
1,633 行
$this->assertText('[action=index]'); } function testJumpToUnnamedPage() { $this->get($this->samples() . 'front_controller_style/'); $this->clickLink('No page'); $this->assertResponse(200); $this->assertText('Simple test front controller'); $this->assertText('[action=no_page]'); } function testJumpToUnnamedPageWithBareParameter() { $this->get($this->samples() . 'front_controller_style/'); $this->clickLink('Bare action'); $this->assertResponse(200); $this->assertText('Simple test front controller'); $this->assertText('[action=]'); } function testJumpToUnnamedPageWithEmptyQuery() { $this->get($this->samples() . 'front_controller_style/'); $this->clickLink('Empty query'); $this->assertResponse(200); $this->assertPattern('/Simple test front controller/'); $this->assertPattern('/raw get data.*?\[\].*?get data/si'); } function testJumpToUnnamedPageWithEmptyLink() { $this->get($this->samples() . 'front_controller_style/'); $this->clickLink('Empty link'); $this->assertResponse(200); $this->assertPattern('/Simple test front controller/'); $this->assertPattern('/raw get data.*?\[\].*?get data/si'); } function testJumpBackADirectoryLevel() { $this->get($this->samples() . 'front_controller_style/'); $this->clickLink('Down one'); $this->assertPattern('|Index of .*?/test|'); } function testSubmitToNamedPage() { $this->get($this->samples() . 'front_controller_style/'); $this->assertText('Simple test front controller'); $this->clickSubmit('Index'); $this->assertResponse(200); $this->assertText('[action=Index]'); } function testSubmitToSameDirectory() { $this->get($this->samples() . 'front_controller_style/index.php'); $this->clickSubmit('Same directory'); $this->assertResponse(200); $this->assertText('[action=Same+directory]'); } function testSubmitToEmptyAction() { $this->get($this->samples() . 'front_controller_style/index.php'); $this->clickSubmit('Empty action'); $this->assertResponse(200); $this->assertText('[action=Empty+action]'); } function testSubmitToNoAction() { $this->get($this->samples() . 'front_controller_style/index.php'); $this->clickSubmit('No action'); $this->assertResponse(200); $this->assertText('[action=No+action]'); } function testSubmitBackADirectoryLevel() { $this->get($this->samples() . 'front_controller_style/'); $this->clickSubmit('Down one'); $this->assertPattern('|Index of .*?/test|'); } function testSubmitToNamedPageWithMixedPostAndGet() { $this->get($this->samples() . 'front_controller_style/?a=A'); $this->assertText('Simple test front controller'); $this->clickSubmit('Index post'); $this->assertText('action=[Index post]'); $this->assertNoText('[a=A]'); } function testSubmitToSameDirectoryMixedPostAndGet() { $this->get($this->samples() . 'front_controller_style/index.php?a=A'); $this->clickSubmit('Same directory post'); $this->assertText('action=[Same directory post]'); $this->assertNoText('[a=A]'); } function testSubmitToEmptyActionMixedPostAndGet() { $this->get($this->samples() . 'front_controller_style/index.php?a=A'); $this->clickSubmit('Empty action post'); $this->assertText('action=[Empty action post]'); $this->assertText('[a=A]'); } function testSubmitToNoActionMixedPostAndGet() { $this->get($this->samples() . 'front_controller_style/index.php?a=A'); $this->clickSubmit('No action post'); $this->assertText('action=[No action post]'); $this->assertText('[a=A]'); }}class TestOfLiveHeaders extends SimpleTestAcceptanceTest { function setUp() { $this->addHeader('User-Agent: SimpleTest ' . SimpleTest::getVersion()); } function testConfirmingHeaderExistence() { $this->get('http://www.lastcraft.com/'); $this->assertHeader('content-type'); $this->assertHeader('content-type', 'text/html'); $this->assertHeaderPattern('content-type', '/HTML/i'); $this->assertNoHeader('WWW-Authenticate'); }} class TestOfLiveRedirects extends SimpleTestAcceptanceTest { function setUp() { $this->addHeader('User-Agent: SimpleTest ' . SimpleTest::getVersion()); } function testNoRedirects() { $this->setMaximumRedirects(0); $this->get($this->samples() . 'redirect.php'); $this->assertTitle('Redirection test'); } function testRedirects() { $this->setMaximumRedirects(1); $this->get($this->samples() . 'redirect.php'); $this->assertTitle('Simple test target file'); } function testRedirectLosesGetData() { $this->get($this->samples() . 'redirect.php', array('a' => 'aaa')); $this->assertNoText('a=[aaa]'); } function testRedirectKeepsExtraRequestDataOfItsOwn() { $this->get($this->samples() . 'redirect.php'); $this->assertText('r=[rrr]'); } function testRedirectLosesPostData() { $this->post($this->samples() . 'redirect.php', array('a' => 'aaa')); $this->assertTitle('Simple test target file'); $this->assertNoText('a=[aaa]'); } function testRedirectWithBaseUrlChange() { $this->get($this->samples() . 'base_change_redirect.php'); $this->assertTitle('Simple test target file in folder'); $this->get($this->samples() . 'path/base_change_redirect.php'); $this->assertTitle('Simple test target file'); } function testRedirectWithDoubleBaseUrlChange() { $this->get($this->samples() . 'double_base_change_redirect.php'); $this->assertTitle('Simple test target file'); }}class TestOfLiveCookies extends SimpleTestAcceptanceTest { function setUp() { $this->addHeader('User-Agent: SimpleTest ' . SimpleTest::getVersion()); } function here() { return new SimpleUrl($this->samples()); } function thisHost() { $here = $this->here(); return $here->getHost(); } function thisPath() { $here = $this->here(); return $here->getPath(); } function testCookieSettingAndAssertions() { $this->setCookie('a', 'Test cookie a'); $this->setCookie('b', 'Test cookie b', $this->thisHost()); $this->setCookie('c', 'Test cookie c', $this->thisHost(), $this->thisPath()); $this->get($this->samples() . 'network_confirm.php'); $this->assertText('Test cookie a'); $this->assertText('Test cookie b'); $this->assertText('Test cookie c'); $this->assertCookie('a'); $this->assertCookie('b', 'Test cookie b'); $this->assertTrue($this->getCookie('c') == 'Test cookie c'); } function testNoCookieSetWhenCookiesDisabled() { $this->setCookie('a', 'Test cookie a'); $this->ignoreCookies(); $this->get($this->samples() . 'network_confirm.php'); $this->assertNoText('Test cookie a'); } function testCookieReading() { $this->get($this->samples() . 'set_cookies.php'); $this->assertCookie('session_cookie', 'A'); $this->assertCookie('short_cookie', 'B'); $this->assertCookie('day_cookie', 'C'); } function testNoCookieReadingWhenCookiesDisabled() { $this->ignoreCookies(); $this->get($this->samples() . 'set_cookies.php'); $this->assertNoCookie('session_cookie'); $this->assertNoCookie('short_cookie'); $this->assertNoCookie('day_cookie'); } function testCookiePatternAssertions() { $this->get($this->samples() . 'set_cookies.php'); $this->assertCookie('session_cookie', new PatternExpectation('/a/i')); } function testTemporaryCookieExpiry() { $this->get($this->samples() . 'set_cookies.php'); $this->restart(); $this->assertNoCookie('session_cookie'); $this->assertCookie('day_cookie', 'C'); } function testTimedCookieExpiryWith100SecondMargin() { $this->get($this->samples() . 'set_cookies.php'); $this->ageCookies(3600); $this->restart(time() + 100); $this->assertNoCookie('session_cookie'); $this->assertNoCookie('hour_cookie'); $this->assertCookie('day_cookie', 'C'); } function testNoClockOverDriftBy100Seconds() { $this->get($this->samples() . 'set_cookies.php'); $this->restart(time() + 200); $this->assertNoCookie( 'short_cookie', '%s -> Please check your computer clock setting if you are not using NTP'); } function testNoClockUnderDriftBy100Seconds() { $this->get($this->samples() . 'set_cookies.php'); $this->restart(time() + 0); $this->assertCookie( 'short_cookie', 'B', '%s -> Please check your computer clock setting if you are not using NTP'); } function testCookiePath() { $this->get($this->samples() . 'set_cookies.php'); $this->assertNoCookie('path_cookie', 'D'); $this->get('./path/show_cookies.php'); $this->assertPattern('/path_cookie/'); $this->assertCookie('path_cookie', 'D'); }}class LiveTestOfForms extends SimpleTestAcceptanceTest { function setUp() { $this->addHeader('User-Agent: SimpleTest ' . SimpleTest::getVersion()); } function testSimpleSubmit() { $this->get($this->samples() . 'form.html'); $this->assertTrue($this->clickSubmit('Go!')); $this->assertPattern('/Request method.*?<dd>POST<\/dd>/'); $this->assertText('go=[Go!]'); } function testDefaultFormValues() { $this->get($this->samples() . 'form.html'); $this->assertFieldByName('a', ''); $this->assertFieldByName('b', 'Default text'); $this->assertFieldByName('c', ''); $this->assertFieldByName('d', 'd1'); $this->assertFieldByName('e', false); $this->assertFieldByName('f', 'on'); $this->assertFieldByName('g', 'g3'); $this->assertFieldByName('h', 2); $this->assertFieldByName('go', 'Go!'); $this->assertClickable('Go!'); $this->assertSubmit('Go!'); $this->assertTrue($this->clickSubmit('Go!')); $this->assertText('go=[Go!]'); $this->assertText('a=[]'); $this->assertText('b=[Default text]'); $this->assertText('c=[]'); $this->assertText('d=[d1]'); $this->assertNoText('e=['); $this->assertText('f=[on]'); $this->assertText('g=[g3]'); } function testFormSubmissionByButtonLabel() { $this->get($this->samples() . 'form.html'); $this->setFieldByName('a', 'aaa'); $this->setFieldByName('b', 'bbb'); $this->setFieldByName('c', 'ccc'); $this->setFieldByName('d', 'D2'); $this->setFieldByName('e', 'on'); $this->setFieldByName('f', false); $this->setFieldByName('g', 'g2'); $this->setFieldByName('h', 1); $this->assertTrue($this->clickSubmit('Go!')); $this->assertText('a=[aaa]'); $this->assertText('b=[bbb]'); $this->assertText('c=[ccc]'); $this->assertText('d=[d2]'); $this->assertText('e=[on]'); $this->assertNoText('f=['); $this->assertText('g=[g2]'); } function testAdditionalFormValues() { $this->get($this->samples() . 'form.html'); $this->assertTrue($this->clickSubmit('Go!', array('add' => 'A'))); $this->assertText('go=[Go!]');
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?