SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    Foozle Reducer ServerStorm's Avatar
    Join Date
    Feb 2005
    Location
    Burlington, Canada
    Posts
    2,699
    Mentioned
    89 Post(s)
    Tagged
    6 Thread(s)

    assertTitle() SimpleTest Not Working

    Hi,

    I know that SimpleTest's web tester is working because this passes:
    PHP Code:
    class PageTestCase extends WebTestCase 
    {
        protected 
    $url='http://pathtomysite/login.php';
        
        function 
    testPage() 
        {
            
    $this->get($this->url);
            
    $this->assertNoUnwantedPattern('/fatal error/i');
        } 
    However when I add assertTitle it fails:
    PHP Code:
    class PageTestCase extends WebTestCase 
    {
        protected 
    $url='http://pathtomysite/login.php';
        
        function 
    testPage() 
        {
            
    $this->get($this->url);
            
    $this->assertNoUnwantedPattern('/fatal error/i');
            
    $this->assertTitle('Login Form');
        } 
    The HTML that is looking at is
    HTML Code:
    <!doctype html public "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
        <head>
            <title>Login Form</title>
            <meta http-equiv="Content-type" content="text/html" charset="iso-8859-1" />
            <LINK rel="stylesheet" type="text/css" href="login.css" />
        </head>
        <body>
    Any idea why SimpleTest is reporting:
    Fail: PageTestCase -> testPage -> Equal expectation fails at character 0 with [Login Form] and [] at [/path/yourapp/tests/Login_test.php line 35]
    Regards,
    Steve
    ictus==""

  2. #2
    ********* Victim lastcraft's Avatar
    Join Date
    Apr 2003
    Location
    London
    Posts
    2,423
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Hi...

    Good question. You can see the output it fetched simply by placing a print in front of any fetching commends (they return the raw output).
    PHP Code:
    print $this->get(...); 
    This should confirm you are seeing what you are really seeing. Or try adding...
    PHP Code:
    $this->showRequest();
    $this->showHeaders();
    $this->showSource(); 
    ...after the fetch for a browser visible output.

    yours, Marcus
    Marcus Baker
    Testing: SimpleTest, Cgreen, Fakemail
    Other: Phemto dependency injector
    Books: PHP in Action, 97 things


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •