PHP 클래스 CIPHPUnitTestCase, ci-phpunit-test

상속: extends PHPUnit_Framework_TestCase
파일 보기 프로젝트 열기: kenjis/ci-phpunit-test 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$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