From af68030fcf0c266300feb2c100149ecadef7d364 Mon Sep 17 00:00:00 2001 From: xue <> Date: Sun, 16 Jul 2006 01:50:23 +0000 Subject: Merge from 3.0 branch till 1264. --- .../docs/en/web_tester_documentation.html | 31 ++++++++++++---------- 1 file changed, 17 insertions(+), 14 deletions(-) (limited to 'tests/test_tools/simpletest/docs/en/web_tester_documentation.html') diff --git a/tests/test_tools/simpletest/docs/en/web_tester_documentation.html b/tests/test_tools/simpletest/docs/en/web_tester_documentation.html index 51f604be..99dacacc 100755 --- a/tests/test_tools/simpletest/docs/en/web_tester_documentation.html +++ b/tests/test_tools/simpletest/docs/en/web_tester_documentation.html @@ -21,9 +21,6 @@ Group tests
  • -Server stubs -
  • -
  • Mock objects
  • @@ -153,7 +150,7 @@ class TestOfLastcraft extends WebTestCase { function testHomepage() { $this->get('http://www.lastcraft.com/'); - $this->assertWantedPattern('/why the last craft/i'); + $this->assertTest('Why the last craft'); } } @@ -169,16 +166,16 @@ class TestOfLastcraft extends WebTestCase { assertTitle($title)Pass if title is an exact match -assertWantedPattern($pattern)A Perl pattern match against the page content +assertPattern($pattern)A Perl pattern match against the page content -assertNoUnwantedPattern($pattern)A Perl pattern match to not find content +assertNoPattern($pattern)A Perl pattern match to not find content -assertWantedText($text)Pass if matches visible and "alt" text +assertText($text)Pass if matches visible and "alt" text -assertNoUnwantedText($text)Pass if doesn't match visible and "alt" text +assertNoText($text)Pass if doesn't match visible and "alt" text assertLink($label)Pass if a link with this text is present @@ -217,10 +214,7 @@ class TestOfLastcraft extends WebTestCase { assertHeader($header, $content)Pass if a header was fetched matching this value -assertNoUnwantedHeader($header)Pass if a header was not fetched - - -assertHeaderPattern($header, $pattern)Pass if a header was fetched matching this Perl regex +assertNoHeader($header)Pass if a header was not fetched assertCookie($name, $value)Pass if there is currently a matching cookie @@ -240,6 +234,10 @@ class TestOfLastcraft extends WebTestCase { So now we could instead test against the title tag with...
     $this->assertTitle('The Last Craft? Web developer tutorials on PHP, Extreme programming and Object Oriented development');
    +
    + ...or, if that is too long and fragile... +
    +$this->assertTitle(new PatternExpectation('/The Last Craft/'));
     
    As well as the simple HTML content checks we can check that the MIME type is in a list of allowed types with... @@ -319,7 +317,7 @@ class TestOfLastcraft extends WebTestCase { function testContact() { $this->get('http://www.lastcraft.com/'); $this->clickLink('About'); - $this->assertTitle('About Last Craft'); + $this->assertTitle(new PatternExpectation('/About Last Craft/')); } } @@ -327,10 +325,15 @@ class TestOfLastcraft extends WebTestCase {

    If the target is a button rather than an anchor tag, then - clickSubmit() should be used + clickSubmit() can be used with the button title...

     $this->clickSubmit('Go!');
    +
    + If you are not sure or don't care, the usual case, then just + use the click() method... +
    +$this->click('Go!');
     

    -- cgit v1.2.3