Reputation: 1207
I am trying a very simple test like this :
public function index()
{
$this->open('');
$this->assertTitle(Yii::app()->name);
}
with the appropriate fixtures :
'accueil' => array(
'id' => 1,
'title' => Yii::app()->name,
'name' => "accueil",
[etc...]
),
But when I run the functional test, the assertTitle method fails :
Failed command: assertTitle('comptabilite-personnelle.net (dev)') Failed asserting that 'comptabilite-personnelle.net (dev)' matches PCRE pattern "/^comptabilite-personnelle.net (dev)$/".
OTOH, the following code does not fail :
Fixtures :
'accueil' => array(
'id' => 1,
'title' => 'whatever',
'name' => "accueil",
[etc...]
),
Assertion :
$this->assertTitle('whatever');
Any idea about this behavior welcome !
Upvotes: 0
Views: 224
Reputation: 10800
If you just want to check if your page title contains you app name and not want to check if your page title is exactly the same as your app name you need to do it like that:
$this->assertTitle('regexp:.*' . Yii::app()->name . '.*');
Upvotes: 0