acceptance_test.php.svn-base
来自「PHP 知识管理系统(基于树结构的知识管理系统), 英文原版的PHP源码。」· SVN-BASE 代码 · 共 1,633 行 · 第 1/5 页
SVN-BASE
1,633 行
$this->assertText('e=[&\'"<>]'); $this->assertText("i=[']"); } function testFormActionRespectsBaseTag() { $this->get($this->samples() . 'base_tag/form.html'); $this->assertTrue($this->clickSubmit('Go!')); $this->assertText('go=[Go!]'); $this->assertText('a=[]'); }}class TestOfLiveMultiValueWidgets extends SimpleTestAcceptanceTest { function setUp() { $this->addHeader('User-Agent: SimpleTest ' . SimpleTest::getVersion()); } function testDefaultFormValueSubmission() { $this->get($this->samples() . 'multiple_widget_form.html'); $this->assertFieldByName('a', array('a2', 'a3')); $this->assertFieldByName('b', array('b2', 'b3')); $this->assertFieldByName('c[]', array('c2', 'c3')); $this->assertFieldByName('d', array('2', '3')); $this->assertFieldByName('e', array('2', '3')); $this->assertTrue($this->clickSubmit('Go!')); $this->assertText('a=[a2, a3]'); $this->assertText('b=[b2, b3]'); $this->assertText('c=[c2, c3]'); $this->assertText('d=[2, 3]'); $this->assertText('e=[2, 3]'); } function testSubmittingMultipleValues() { $this->get($this->samples() . 'multiple_widget_form.html'); $this->setFieldByName('a', array('a1', 'a4')); $this->assertFieldByName('a', array('a1', 'a4')); $this->assertFieldByName('a', array('a4', 'a1')); $this->setFieldByName('b', array('b1', 'b4')); $this->assertFieldByName('b', array('b1', 'b4')); $this->setFieldByName('c[]', array('c1', 'c4')); $this->assertField('c[]', array('c1', 'c4')); $this->setFieldByName('d', array('1', '4')); $this->assertField('d', array('1', '4')); $this->setFieldByName('e', array('e1', 'e4')); $this->assertField('e', array('1', '4')); $this->assertTrue($this->clickSubmit('Go!')); $this->assertText('a=[a1, a4]'); $this->assertText('b=[b1, b4]'); $this->assertText('c=[c1, c4]'); $this->assertText('d=[1, 4]'); $this->assertText('e=[1, 4]'); } function testSettingByOptionValue() { $this->get($this->samples() . 'multiple_widget_form.html'); $this->setFieldByName('d', array('1', '4')); $this->assertField('d', array('1', '4')); $this->assertTrue($this->clickSubmit('Go!')); $this->assertText('d=[1, 4]'); } function testSubmittingMultipleValuesByLabel() { $this->get($this->samples() . 'multiple_widget_form.html'); $this->setField('Multiple selection A', array('a1', 'a4')); $this->assertField('Multiple selection A', array('a1', 'a4')); $this->assertField('Multiple selection A', array('a4', 'a1')); $this->setField('multiple selection C', array('c1', 'c4')); $this->assertField('multiple selection C', array('c1', 'c4')); $this->assertTrue($this->clickSubmit('Go!')); $this->assertText('a=[a1, a4]'); $this->assertText('c=[c1, c4]'); } function testSavantStyleHiddenFieldDefaults() { $this->get($this->samples() . 'savant_style_form.html'); $this->assertFieldByName('a', array('a0')); $this->assertFieldByName('b', array('b0')); $this->assertTrue($this->clickSubmit('Go!')); $this->assertText('a=[a0]'); $this->assertText('b=[b0]'); } function testSavantStyleHiddenDefaultsAreOverridden() { $this->get($this->samples() . 'savant_style_form.html'); $this->assertTrue($this->setFieldByName('a', array('a1'))); $this->assertTrue($this->setFieldByName('b', 'b1')); $this->assertTrue($this->clickSubmit('Go!')); $this->assertText('a=[a1]'); $this->assertText('b=[b1]'); } function testSavantStyleFormSettingById() { $this->get($this->samples() . 'savant_style_form.html'); $this->assertFieldById(1, array('a0')); $this->assertFieldById(4, array('b0')); $this->assertTrue($this->setFieldById(2, 'a1')); $this->assertTrue($this->setFieldById(5, 'b1')); $this->assertTrue($this->clickSubmitById(99)); $this->assertText('a=[a1]'); $this->assertText('b=[b1]'); }}class TestOfFileUploads extends SimpleTestAcceptanceTest { function setUp() { $this->addHeader('User-Agent: SimpleTest ' . SimpleTest::getVersion()); } function testSingleFileUpload() { $this->get($this->samples() . 'upload_form.html'); $this->assertTrue($this->setField('Content:', dirname(__FILE__) . '/support/upload_sample.txt')); $this->assertField('Content:', dirname(__FILE__) . '/support/upload_sample.txt'); $this->click('Go!'); $this->assertText('Sample for testing file upload'); } function testMultipleFileUpload() { $this->get($this->samples() . 'upload_form.html'); $this->assertTrue($this->setField('Content:', dirname(__FILE__) . '/support/upload_sample.txt')); $this->assertTrue($this->setField('Supplemental:', dirname(__FILE__) . '/support/supplementary_upload_sample.txt')); $this->assertField('Supplemental:', dirname(__FILE__) . '/support/supplementary_upload_sample.txt'); $this->click('Go!'); $this->assertText('Sample for testing file upload'); $this->assertText('Some more text content'); } function testBinaryFileUpload() { $this->get($this->samples() . 'upload_form.html'); $this->assertTrue($this->setField('Content:', dirname(__FILE__) . '/support/latin1_sample')); $this->click('Go!'); $this->assertText( implode('', file(dirname(__FILE__) . '/support/latin1_sample'))); }}class TestOfLiveHistoryNavigation extends SimpleTestAcceptanceTest { function setUp() { $this->addHeader('User-Agent: SimpleTest ' . SimpleTest::getVersion()); } function testRetry() { $this->get($this->samples() . 'cookie_based_counter.php'); $this->assertPattern('/count: 1/i'); $this->retry(); $this->assertPattern('/count: 2/i'); $this->retry(); $this->assertPattern('/count: 3/i'); } function testOfBackButton() { $this->get($this->samples() . '1.html'); $this->clickLink('2'); $this->assertTitle('2'); $this->assertTrue($this->back()); $this->assertTitle('1'); $this->assertTrue($this->forward()); $this->assertTitle('2'); $this->assertFalse($this->forward()); } function testGetRetryResubmitsData() { $this->assertTrue($this->get( $this->samples() . 'network_confirm.php?a=aaa')); $this->assertPattern('/Request method.*?<dd>GET<\/dd>/'); $this->assertText('a=[aaa]'); $this->retry(); $this->assertPattern('/Request method.*?<dd>GET<\/dd>/'); $this->assertText('a=[aaa]'); } function testGetRetryResubmitsExtraData() { $this->assertTrue($this->get( $this->samples() . 'network_confirm.php', array('a' => 'aaa'))); $this->assertPattern('/Request method.*?<dd>GET<\/dd>/'); $this->assertText('a=[aaa]'); $this->retry(); $this->assertPattern('/Request method.*?<dd>GET<\/dd>/'); $this->assertText('a=[aaa]'); } function testPostRetryResubmitsData() { $this->assertTrue($this->post( $this->samples() . 'network_confirm.php', array('a' => 'aaa'))); $this->assertPattern('/Request method.*?<dd>POST<\/dd>/'); $this->assertText('a=[aaa]'); $this->retry(); $this->assertPattern('/Request method.*?<dd>POST<\/dd>/'); $this->assertText('a=[aaa]'); } function testGetRetryResubmitsRepeatedData() { $this->assertTrue($this->get( $this->samples() . 'network_confirm.php?a=1&a=2')); $this->assertPattern('/Request method.*?<dd>GET<\/dd>/'); $this->assertText('a=[1, 2]'); $this->retry(); $this->assertPattern('/Request method.*?<dd>GET<\/dd>/'); $this->assertText('a=[1, 2]'); }}class TestOfLiveAuthentication extends SimpleTestAcceptanceTest { function setUp() { $this->addHeader('User-Agent: SimpleTest ' . SimpleTest::getVersion()); } function testChallengeFromProtectedPage() { $this->get($this->samples() . 'protected/'); $this->assertResponse(401); $this->assertAuthentication('Basic'); $this->assertRealm('SimpleTest basic authentication'); $this->assertRealm(new PatternExpectation('/simpletest/i')); $this->authenticate('test', 'secret'); $this->assertResponse(200); $this->retry(); $this->assertResponse(200); } function testTrailingSlashImpliedWithinRealm() { $this->get($this->samples() . 'protected/'); $this->authenticate('test', 'secret'); $this->assertResponse(200); $this->get($this->samples() . 'protected'); $this->assertResponse(200); } function testTrailingSlashImpliedSettingRealm() { $this->get($this->samples() . 'protected'); $this->authenticate('test', 'secret'); $this->assertResponse(200); $this->get($this->samples() . 'protected/'); $this->assertResponse(200); } function testEncodedAuthenticationFetchesPage() { $this->get('http://test:secret@www.lastcraft.com/test/protected/'); $this->assertResponse(200); } function testEncodedAuthenticationFetchesPageAfterTrailingSlashRedirect() { $this->get('http://test:secret@www.lastcraft.com/test/protected'); $this->assertResponse(200); } function testRealmExtendsToWholeDirectory() { $this->get($this->samples() . 'protected/1.html'); $this->authenticate('test', 'secret'); $this->clickLink('2'); $this->assertResponse(200); $this->clickLink('3'); $this->assertResponse(200); } function testRedirectKeepsAuthentication() { $this->get($this->samples() . 'protected/local_redirect.php'); $this->authenticate('test', 'secret'); $this->assertTitle('Simple test target file'); } function testRedirectKeepsEncodedAuthentication() { $this->get('http://test:secret@www.lastcraft.com/test/protected/local_redirect.php'); $this->assertResponse(200); $this->assertTitle('Simple test target file'); } function testSessionRestartLosesAuthentication() { $this->get($this->samples() . 'protected/'); $this->authenticate('test', 'secret'); $this->assertResponse(200); $this->restart(); $this->get($this->samples() . 'protected/'); $this->assertResponse(401); }}class TestOfLoadingFrames extends SimpleTestAcceptanceTest { function setUp() { $this->addHeader('User-Agent: SimpleTest ' . SimpleTest::getVersion()); } function testNoFramesContentWhenFramesDisabled() { $this->ignoreFrames(); $this->get($this->samples() . 'one_page_frameset.html'); $this->assertTitle('Frameset for testing of SimpleTest'); $this->assertText('This content is for no frames only'); } function testPatternMatchCanReadTheOnlyFrame() { $this->get($this->samples() . 'one_page_frameset.html'); $this->assertText('A target for the SimpleTest test suite'); $this->assertNoText('This content is for no frames only'); } function testMessyFramesetResponsesByName() { $this->assertTrue($this->get( $this->samples() . 'messy_frameset.html')); $this->assertTitle('Frameset for testing of SimpleTest'); $this->assertTrue($this->setFrameFocus('Front controller')); $this->assertResponse(200); $this->assertText('Simple test front controller'); $this->assertTrue($this->setFrameFocus('One')); $this->assertResponse(200); $this->assertLink('2'); $this->assertTrue($this->setFrameFocus('Frame links')); $this->assertResponse(200); $this->assertLink('Set one to 2'); $this->assertTrue($this->setFrameFocus('Counter')); $this->assertResponse(200); $this->assertText('Count: 1'); $this->assertTrue($this->setFrameFocus('Redirected')); $this->assertResponse(200); $this->assertText('r=rrr'); $this->assertTrue($this->setFrameFocus('Protected')); $this->assertResponse(401);
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?