mirror of
https://github.com/wallabag/wallabag.git
synced 2025-07-27 17:28:39 +00:00
symfony is there
This commit is contained in:
parent
0440249631
commit
93fd4692f6
291 changed files with 11356 additions and 1696 deletions
45
src/Acme/DemoBundle/Tests/Controller/DemoControllerTest.php
Normal file
45
src/Acme/DemoBundle/Tests/Controller/DemoControllerTest.php
Normal file
|
@ -0,0 +1,45 @@
|
|||
<?php
|
||||
|
||||
namespace Acme\DemoBundle\Tests\Controller;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||
|
||||
class DemoControllerTest extends WebTestCase
|
||||
{
|
||||
public function testIndex()
|
||||
{
|
||||
$client = static::createClient();
|
||||
|
||||
$crawler = $client->request('GET', '/demo/hello/Fabien');
|
||||
|
||||
$this->assertGreaterThan(0, $crawler->filter('html:contains("Hello Fabien")')->count());
|
||||
}
|
||||
|
||||
public function testSecureSection()
|
||||
{
|
||||
$client = static::createClient();
|
||||
|
||||
// goes to the secure page
|
||||
$crawler = $client->request('GET', '/demo/secured/hello/World');
|
||||
|
||||
// redirects to the login page
|
||||
$crawler = $client->followRedirect();
|
||||
|
||||
// submits the login form
|
||||
$form = $crawler->selectButton('Login')->form(array('_username' => 'admin', '_password' => 'adminpass'));
|
||||
$client->submit($form);
|
||||
|
||||
// redirect to the original page (but now authenticated)
|
||||
$crawler = $client->followRedirect();
|
||||
|
||||
// check that the page is the right one
|
||||
$this->assertCount(1, $crawler->filter('h1.title:contains("Hello World!")'));
|
||||
|
||||
// click on the secure link
|
||||
$link = $crawler->selectLink('Hello resource secured')->link();
|
||||
$crawler = $client->click($link);
|
||||
|
||||
// check that the page is the right one
|
||||
$this->assertCount(1, $crawler->filter('h1.title:contains("secured for Admins only!")'));
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue