Skip to content

Instantly share code, notes, and snippets.

@list
Created October 20, 2011 19:39
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save list/1302102 to your computer and use it in GitHub Desktop.
Save list/1302102 to your computer and use it in GitHub Desktop.
Using Goutte for functional test in Yii
<?php
use Goutte\Client;
class LayoutLinksTest extends LibWebTestCase {
/** @test */
public function shouldHaveTheRightLinksOnTheLayout() {
$client = new Client();
$crawler = $client->request('GET', TEST_BASE_URL);
$this->assertStringEndsWith('Home', $crawler->filter('title')->text());
$crawler = $client->click($crawler->selectLink('About')->link());
$this->assertStringEndsWith('About', $crawler->filter('title')->text());
$crawler = $client->click($crawler->selectLink('Contact')->link());
$this->assertStringEndsWith('Contact', $crawler->filter('title')->text());
$crawler = $client->click($crawler->selectLink('Home')->link());
$this->assertStringEndsWith('Home', $crawler->filter('title')->text());
$crawler = $client->click($crawler->selectLink('Sign up now!')->link());
$this->assertStringEndsWith('Sign up', $crawler->filter('title')->text());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment