PHP Класс CIPHPUnitTestCase, ci-phpunit-test

Наследование: extends PHPUnit_Framework_TestCase
Показать файл Открыть проект Примеры использования класса

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

Свойство Тип Описание
$CI CodeIgniter instance
$_error_reporting
$backupGlobalsBlacklist array You would see Exception: Serialization of 'Closure' is not allowed.
$class_map

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

Метод Описание
__get ( $name )
ajaxRequest ( string $http_method, array | string $argv, array $params = [] ) Request to Controller using ajax request
assertRedirect ( string $uri, integer $code = null ) Asserts Redirect
assertResponseCode ( integer $code ) Asserts HTTP response code
assertResponseCookie ( string $name, string | array $value, boolean $allow_duplicate = false ) Asserts HTTP response cookie
assertResponseHeader ( string $name, string $value ) Asserts HTTP response header
getDouble ( string $classname, array $params, boolean $enable_constructor = false ) : object Get Mock Object
newController ( string $classname ) : CI_Controller Create a controller instance
request ( string $http_method, array | string $argv, array $params = [] ) Request to Controller
resetInstance ( ) Reset CodeIgniter instance and assign new CodeIgniter instance as $this->CI
setCI ( CI_Controller $CI )
setUpBeforeClass ( )
verifyInvoked ( object $mock, string $method, array $params = null ) Verifies a method was invoked at least once
verifyInvokedMultipleTimes ( object $mock, string $method, integer $times, array $params = null ) Verifies that method was called exactly $times times
verifyInvokedOnce ( object $mock, string $method, array $params = null ) Verifies that method was invoked only once
verifyNeverInvoked ( object $mock, string $method, array $params = null ) Verifies that method was not called
warningOff ( )
warningOn ( )

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

Метод Описание
tearDown ( )

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

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

public __get ( $name )

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

Request to Controller using ajax request
public ajaxRequest ( string $http_method, array | string $argv, array $params = [] )
$http_method string HTTP method
$argv array | string array of controller,method,arg|uri
$params array POST parameters/Query string

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

Asserts Redirect
public assertRedirect ( string $uri, integer $code = null )
$uri string URI to redirect
$code integer response code

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

Asserts HTTP response code
public assertResponseCode ( integer $code )
$code integer

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

Asserts HTTP response cookie
public assertResponseCookie ( string $name, string | array $value, boolean $allow_duplicate = false )
$name string cookie name
$value string | array cookie value|array of cookie params
$allow_duplicate boolean whether to allow duplicated cookies

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

Asserts HTTP response header
public assertResponseHeader ( string $name, string $value )
$name string header name
$value string header value

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

$email = $this->getMockBuilder('CI_Email') ->setMethods(['send']) ->getMock(); $email->method('send')->willReturn(TRUE); will be $email = $this->getDouble('CI_Email', ['send' => TRUE]);
public getDouble ( string $classname, array $params, boolean $enable_constructor = false ) : object
$classname string
$params array [method_name => return_value]
$enable_constructor boolean enable constructor or not
Результат object PHPUnit mock object

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

Create a controller instance
public newController ( string $classname ) : CI_Controller
$classname string
Результат CI_Controller

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

Request to Controller
public request ( string $http_method, array | string $argv, array $params = [] )
$http_method string HTTP method
$argv array | string array of controller,method,arg|uri
$params array POST parameters/Query string

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

Reset CodeIgniter instance and assign new CodeIgniter instance as $this->CI
public resetInstance ( )

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

public setCI ( CI_Controller $CI )
$CI CI_Controller

setUpBeforeClass() публичный статический Метод

public static setUpBeforeClass ( )

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

protected tearDown ( )

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

Verifies a method was invoked at least once
public verifyInvoked ( object $mock, string $method, array $params = null )
$mock object PHPUnit mock object
$method string
$params array arguments

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

$loader->expects($this->exactly(2)) ->method('view') ->withConsecutive( ['shop_confirm', $this->anything(), TRUE], ['shop_tmpl_checkout', $this->anything()] ); will be $this->verifyInvokedMultipleTimes( $loader, 'view', 2, [ ['shop_confirm', $this->anything(), TRUE], ['shop_tmpl_checkout', $this->anything()] ] );
public verifyInvokedMultipleTimes ( object $mock, string $method, integer $times, array $params = null )
$mock object PHPUnit mock object
$method string
$times integer
$params array arguments

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

Verifies that method was invoked only once
public verifyInvokedOnce ( object $mock, string $method, array $params = null )
$mock object PHPUnit mock object
$method string
$params array arguments

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

Verifies that method was not called
public verifyNeverInvoked ( object $mock, string $method, array $params = null )
$mock object PHPUnit mock object
$method string
$params array arguments

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

public warningOff ( )

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

public warningOn ( )

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

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

CodeIgniter instance
protected $CI

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

protected $_error_reporting

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

You would see Exception: Serialization of 'Closure' is not allowed.
protected array $backupGlobalsBlacklist
Результат array

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

protected $class_map