\NetCommonsControllerBaseTestCase

NetCommonsControllerTestCase

Summary

Methods
Properties
Constants
__construct()
setUp()
tearDown()
generateNc()
assertDatetime()
assertRedirect()
$plugin
$data
No constants found
_clear()
_testReflectionMethod()
_parseView()
$_controller
$_isFixtureMerged
$_fixtures
N/A
No private methods found
No private properties found
N/A

Properties

$plugin

$plugin : string

Plugin name

Type

string

$data

$data : array

Post data

Type

array

$_controller

$_controller : string

Controller name

Type

string

$_isFixtureMerged

$_isFixtureMerged : boolean

Fixture merge

Type

boolean

$_fixtures

$_fixtures : array

Fixtures

Type

array

Methods

__construct()

__construct(string  $name = null, array  $data = array(), string  $dataName = '') : void

Fixtures load

Parameters

string $name

The name parameter on PHPUnit_Framework_TestCase::__construct()

array $data

The date parameter on PHPUnit_Framework_TestCase::__construct()

string $dataName

The dataName parameter on PHPUnit_Framework_TestCase::__construct()

setUp()

setUp() : void

setUp method

tearDown()

tearDown() : void

tearDown method

generateNc()

generateNc(string  $controller, array  $mocks = array()) : \Controller

Generates a mocked controller and mocks any classes passed to `$mocks`. By default, `_stop()` is stubbed as is sending the response headers, so to not interfere with testing.

Mocks:

  • methods Methods to mock on the controller. _stop() is mocked by default
  • models Models to mock. Models are added to the ClassRegistry so any time they are instantiated the mock will be created. Pass as key value pairs with the value being specific methods on the model to mock. If true or no value is passed, the entire model will be mocked.
  • components Components to mock. Components are only mocked on this controller and not within each other (i.e., components on components)

Parameters

string $controller

Controller name

array $mocks

List of classes and methods to mock

Returns

\Controller —

Mocked controller

assertDatetime()

assertDatetime(string  $result, string  $message = null) : void

Assert Date time

Parameters

string $result

Result data

string $message

メッセージ

assertRedirect()

assertRedirect(string  $result, string  $message = null) : void

リダイレクトの評価

Parameters

string $result

期待値

string $message

メッセージ

_clear()

_clear() : void

初期化

_testReflectionMethod()

_testReflectionMethod(\Instance  $instance, string  $mockMethod, array  $params = array()) : void

privateおよびprotectedメソッドのテスト

Parameters

\Instance $instance

インスタンス

string $mockMethod

Mockのメソッド

array $params

Mockのメソッドのパラメータ

_parseView()

_parseView(string  $view) : string

Viewの結果をスペース等のパースを行う

Parameters

string $view

Viewの結果

Returns

string