2015-02-08 23:05:51 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Wallabag\CoreBundle\Tests;
|
|
|
|
|
|
|
|
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
|
|
|
|
2015-02-16 21:28:49 +01:00
|
|
|
abstract class WallabagTestCase extends WebTestCase
|
2015-02-08 23:05:51 +01:00
|
|
|
{
|
|
|
|
private $client = null;
|
|
|
|
|
|
|
|
public function getClient()
|
|
|
|
{
|
|
|
|
return $this->client;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setUp()
|
|
|
|
{
|
|
|
|
$this->client = static::createClient();
|
|
|
|
}
|
|
|
|
|
2015-02-10 22:32:42 +01:00
|
|
|
public function logInAs($username)
|
2015-02-08 23:05:51 +01:00
|
|
|
{
|
|
|
|
$crawler = $this->client->request('GET', '/login');
|
|
|
|
$form = $crawler->filter('button[type=submit]')->form();
|
|
|
|
$data = array(
|
2015-02-10 22:32:42 +01:00
|
|
|
'_username' => $username,
|
2015-02-17 21:03:23 +01:00
|
|
|
'_password' => 'mypassword',
|
2015-02-08 23:05:51 +01:00
|
|
|
);
|
|
|
|
|
|
|
|
$this->client->submit($form, $data);
|
|
|
|
}
|
|
|
|
}
|