PHP Class common\WebTestCase

Inheritance: extends Symfony\Bundle\FrameworkBundle\Test\WebTestCase
Datei anzeigen Open project: forkcms/forkcms Class Usage Examples

Protected Methods

Method Description
assertIs404 ( Client $client )
backupParametersFile ( string $kernelDir ) Copies the parameters.yml file to a backup version
createClient ( array $options = [], array $server = [] ) : Client Creates a Client.
emptyTestDatabase ( SpoonDatabase $database ) Fully empties the test database
getKernelClass ( ) : string Attempts to guess the kernel location.
importSQL ( SpoonDatabase $database, string $sql ) Executes sql in the database
loadFixtures ( Client $client, array $fixtureClasses = [] )
login ( ) Logs in a user. We do this directly in the authentication class because this is a lot faster than submitting forms and following redirects
logout ( ) Log out a user
putParametersFileBack ( string $kernelDir ) Puts the backed up parameters.yml file back
requestWithGetParameters ( Client $client, string $url, array $data = [] ) : Crawler Do a request with the given GET parameters
setGetParameters ( array $data = [] ) Set the GET parameters, as some of the old code relies on GET
submitEditForm ( Client $client, Form $form, array $data = [] ) Edits the data of a form
submitForm ( Client $client, Form $form, array $data = [] ) Submits the form and mimics the GET parameters, since they aren't added by default in the functional tests
unsetGetParameters ( array $data = [] ) Unset the GET parameters, as some of the old code relies on GET

Method Details

assertIs404() protected method

protected assertIs404 ( Client $client )
$client Symfony\Bundle\FrameworkBundle\Client

backupParametersFile() protected method

Copies the parameters.yml file to a backup version
protected backupParametersFile ( string $kernelDir )
$kernelDir string

createClient() protected static method

Creates a Client.
protected static createClient ( array $options = [], array $server = [] ) : Client
$options array An array of options to pass to the createKernel class
$server array An array of server parameters
return Symfony\Bundle\FrameworkBundle\Client A Client instance

emptyTestDatabase() protected method

Fully empties the test database
protected emptyTestDatabase ( SpoonDatabase $database )
$database SpoonDatabase

getKernelClass() protected static method

When the Kernel is located, the file is required.
protected static getKernelClass ( ) : string
return string The Kernel class name

importSQL() protected method

Executes sql in the database
protected importSQL ( SpoonDatabase $database, string $sql )
$database SpoonDatabase
$sql string

loadFixtures() protected method

protected loadFixtures ( Client $client, array $fixtureClasses = [] )
$client Symfony\Bundle\FrameworkBundle\Client
$fixtureClasses array

login() protected method

Logging in using the forms is tested in the Authentication module
protected login ( )

logout() protected method

Log out a user
protected logout ( )

putParametersFileBack() protected method

Puts the backed up parameters.yml file back
protected putParametersFileBack ( string $kernelDir )
$kernelDir string

requestWithGetParameters() protected method

Do a request with the given GET parameters
protected requestWithGetParameters ( Client $client, string $url, array $data = [] ) : Crawler
$client Symfony\Bundle\FrameworkBundle\Client
$url string
$data array
return Symfony\Component\DomCrawler\Crawler

setGetParameters() protected method

Set the GET parameters, as some of the old code relies on GET
protected setGetParameters ( array $data = [] )
$data array

submitEditForm() protected method

Edits the data of a form
protected submitEditForm ( Client $client, Form $form, array $data = [] )
$client Symfony\Bundle\FrameworkBundle\Client
$form Symfony\Component\DomCrawler\Form
$data array

submitForm() protected method

Submits the form and mimics the GET parameters, since they aren't added by default in the functional tests
protected submitForm ( Client $client, Form $form, array $data = [] )
$client Symfony\Bundle\FrameworkBundle\Client
$form Symfony\Component\DomCrawler\Form
$data array

unsetGetParameters() protected method

Unset the GET parameters, as some of the old code relies on GET
protected unsetGetParameters ( array $data = [] )
$data array