Hello.
While writing first functional tests using Goutte I’ve stumbled upon problem with internationalization.
// pseudocode
public function testDummy()
{
$crawler = $client->request('GET', 'login');
// here user logs in, and sets different than default application language, lets say PL
$title = $crawler->filter('title')->text(); // has value "Title (PL)"
$this->assertEquals(Yii::t('app','Title (EN)'), $title);
//leads to: Failed asserting that "Title (PL)" equals "Title (EN)".
}
HTML returned by crawler is in PL (as it should be), but language in test function is application_default, what messes everything up. As I understand problem, method Yii::t() in test function, and second one inside HTML template works in different scopes.
But I have no idea what to do about it Should I force yii to use default language in tests, or is there more friendly way?
Thanks for any suggestions.