PHP Класс Codeception\Module\Laravel5

Please try it and leave your feedback. The module is based on the Laravel 4 module by Davert. ## Demo project ## Status * Maintainer: **Jan-Henk Gerritsen** * Stability: **dev** * Contact: [email protected] ## Example modules: enabled: - Laravel5 ## Config * cleanup: boolean, default true - all db queries will be run in transaction, which will be rolled back at the end of test. * environment_file: string, default .env - The .env file to load for the tests. * bootstrap: string, default bootstrap/app.php - Relative path to app.php config file. * root: string, default - Root path of our application. * packages: string, default workbench - Root path of application packages (if any). ## API * app - Illuminate\Foundation\Application instance * client - BrowserKit` client ## Parts * ORM - include only haveRecord/grabRecord/seeRecord/dontSeeRecord actions
Наследование: extends Codeception\Lib\Framework, implements Codeception\Lib\Interfaces\ActiveRecord, implements Codeception\Lib\Interfaces\PartedModule
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$app Illuminate\Foundation\Application

Защищенные свойства (Protected)

Свойство Тип Описание
$config array

Открытые методы

Метод Описание
__construct ( $config = null ) Constructor.
_after ( Codeception\TestCase $test ) After hook.
_afterStep ( Codeception\Step $step ) After step hook.
_before ( Codeception\TestCase $test ) Before hook.
_initialize ( ) Initialize hook.
amLoggedAs ( Illuminate\Contracts\Auth\User | array $user, string $driver = null ) : void Set the currently logged in user for the application.
amOnAction ( $action, array $params = [] ) Opens web page by action name
amOnRoute ( $route, array $params = [] ) Opens web page using route name and parameters.
dontSeeAuthentication ( ) Check that user is not authenticated
dontSeeRecord ( $model, array $attributes = [] ) Checks that record does not exist in database.
getApplication ( ) : Illuminate\Foundation\Application Provides access the Laravel application object.
grabRecord ( $model, array $attributes = [] ) : mixed Retrieves record from database
grabService ( string $class ) : mixed Return an instance of a class from the IoC Container.
haveRecord ( $model, array $attributes = [] ) : mixed Inserts record into the database.
logout ( ) Logs user out
seeAuthentication ( ) Checks that user is authenticated
seeCurrentActionIs ( $action, array $params = [] ) Checks that current url matches action
seeCurrentRouteIs ( $route, array $params = [] ) Checks that current url matches route
seeFormErrorMessage ( string $key, string $errorMessage ) Assert that specific form error message is set in the view.
seeFormErrorMessages ( array $bindings ) Assert that specific form error messages are set in the view.
seeFormHasErrors ( ) : boolean Assert that the form errors are bound to the View.
seeInSession ( string | array $key, mixed $value = null ) : void Assert that the session has a given list of values.
seeRecord ( $model, array $attributes = [] ) Checks that record exists in database.
seeSessionHasValues ( array $bindings ) : void Assert that the session has a given list of values.

Защищенные методы

Метод Описание
actionWithNamespace ( string $action ) : string Normalize an action to full namespaced action.
bootApplication ( ) : Illuminate\Foundation\Application Boot the Laravel application object.
findRecord ( $model, array $attributes = [] ) : mixed
getRootControllerNamespace ( ) : string Get the root controller namespace for the application.
initializeLaravel ( ) Initialize the Laravel framework.
revertErrorHandler ( ) Revert back to the Codeception error handler, becauses Laravel registers it's own error handler.

Описание методов

__construct() публичный Метод

Constructor.
public __construct ( $config = null )
$config

_after() публичный Метод

After hook.
public _after ( Codeception\TestCase $test )
$test Codeception\TestCase

_afterStep() публичный Метод

After step hook.
public _afterStep ( Codeception\Step $step )
$step Codeception\Step

_before() публичный Метод

Before hook.
public _before ( Codeception\TestCase $test )
$test Codeception\TestCase

_initialize() публичный Метод

Initialize hook.
public _initialize ( )

actionWithNamespace() защищенный Метод

Normalize an action to full namespaced action.
protected actionWithNamespace ( string $action ) : string
$action string
Результат string

amLoggedAs() публичный Метод

Takes either an object that implements the User interface or an array of credentials.
public amLoggedAs ( Illuminate\Contracts\Auth\User | array $user, string $driver = null ) : void
$user Illuminate\Contracts\Auth\User | array
$driver string
Результат void

amOnAction() публичный Метод

php amOnAction('PostsController@index'); ?>
public amOnAction ( $action, array $params = [] )
$action
$params array

amOnRoute() публичный Метод

php amOnRoute('posts.create'); ?>
public amOnRoute ( $route, array $params = [] )
$route
$params array

bootApplication() защищенный Метод

Boot the Laravel application object.
protected bootApplication ( ) : Illuminate\Foundation\Application
Результат Illuminate\Foundation\Application

dontSeeAuthentication() публичный Метод

Check that user is not authenticated

dontSeeRecord() публичный Метод

php dontSeeRecord('users', array('name' => 'davert')); ?>
public dontSeeRecord ( $model, array $attributes = [] )
$model
$attributes array

findRecord() защищенный Метод

protected findRecord ( $model, array $attributes = [] ) : mixed
$model
$attributes array
Результат mixed

getApplication() публичный Метод

Provides access the Laravel application object.
public getApplication ( ) : Illuminate\Foundation\Application
Результат Illuminate\Foundation\Application

getRootControllerNamespace() защищенный Метод

Get the root controller namespace for the application.
protected getRootControllerNamespace ( ) : string
Результат string

grabRecord() публичный Метод

php grabRecord('users', array('name' => 'davert')); ?>
public grabRecord ( $model, array $attributes = [] ) : mixed
$model
$attributes array
Результат mixed

grabService() публичный Метод

(http://laravel.com/docs/ioc) Example php grabService('foo'); Will return an instance of FooBar, also works for singletons. ?>
public grabService ( string $class ) : mixed
$class string
Результат mixed

haveRecord() публичный Метод

php haveRecord('users', array('name' => 'Davert')); ?>
public haveRecord ( $model, array $attributes = [] ) : mixed
$model
$attributes array
Результат mixed

initializeLaravel() защищенный Метод

Initialize the Laravel framework.
protected initializeLaravel ( )

logout() публичный Метод

Logs user out
public logout ( )

revertErrorHandler() защищенный Метод

Revert back to the Codeception error handler, becauses Laravel registers it's own error handler.
protected revertErrorHandler ( )

seeAuthentication() публичный Метод

Checks that user is authenticated
public seeAuthentication ( )

seeCurrentActionIs() публичный Метод

php seeCurrentActionIs('PostsController@index'); ?>
public seeCurrentActionIs ( $action, array $params = [] )
$action
$params array

seeCurrentRouteIs() публичный Метод

php seeCurrentRouteIs('posts.index'); ?>
public seeCurrentRouteIs ( $route, array $params = [] )
$route
$params array

seeFormErrorMessage() публичный Метод

Useful for validation messages and generally messages array e.g. return Redirect::to('register')->withErrors($validator); Example of Usage php seeFormErrorMessage('username', 'Invalid Username'); ?>
public seeFormErrorMessage ( string $key, string $errorMessage )
$key string
$errorMessage string

seeFormErrorMessages() публичный Метод

Useful for validation messages and generally messages array e.g. return Redirect::to('register')->withErrors($validator); Example of Usage php seeFormErrorMessages(array('username'=>'Invalid Username')); ?>
public seeFormErrorMessages ( array $bindings )
$bindings array

seeFormHasErrors() публичный Метод

Assert that the form errors are bound to the View.
public seeFormHasErrors ( ) : boolean
Результат boolean

seeInSession() публичный Метод

Assert that the session has a given list of values.
public seeInSession ( string | array $key, mixed $value = null ) : void
$key string | array
$value mixed
Результат void

seeRecord() публичный Метод

php $I->seeRecord('users', array('name' => 'davert'));
public seeRecord ( $model, array $attributes = [] )
$model
$attributes array

seeSessionHasValues() публичный Метод

Assert that the session has a given list of values.
public seeSessionHasValues ( array $bindings ) : void
$bindings array
Результат void

Описание свойств

$app публичное свойство

public Application,Illuminate\Foundation $app
Результат Illuminate\Foundation\Application

$config защищенное свойство

protected array $config
Результат array