assertTitle() SimpleTest Not Working

Hi,

I know that SimpleTest’s web tester is working because this passes:

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:

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

<!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

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).


print $this->get(...);

This should confirm you are seeing what you are really seeing. Or try adding…


$this->showRequest();
$this->showHeaders();
$this->showSource();

…after the fetch for a browser visible output.

yours, Marcus