forked from NetCommons3/NetCommons
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNetCommonsModelTestCase.php
More file actions
73 lines (66 loc) · 1.92 KB
/
NetCommonsModelTestCase.php
File metadata and controls
73 lines (66 loc) · 1.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<?php
/**
* NetCommonsModelTestCase class
*
* @author Noriko Arai <arai@nii.ac.jp>
* @author Shohei Nakajima <nakajimashouhei@gmail.com>
* @link http://www.netcommons.org NetCommons Project
* @license http://www.netcommons.org/license.txt NetCommons License
* @copyright Copyright 2014, NetCommons Project
*/
App::uses('NetCommonsCakeTestCase', 'NetCommons.TestSuite');
App::uses('CurrentControlPanel', 'NetCommons.Utility');
/**
* NetCommonsModelTestCase class
*
* @package NetCommons\NetCommons\TestSuite
* @codeCoverageIgnore
*/
class NetCommonsModelTestCase extends NetCommonsCakeTestCase {
/**
* setUp method
*
* @return void
*/
public function setUp() {
parent::setUp();
CurrentControlPanel::setLanguage();
$models = array_keys($this->models);
foreach ($models as $model) {
//Tracableビヘイビアの削除
$this->$model->Behaviors->unload('NetCommons.Trackable');
$this->$model->unbindModel(array('belongsTo' => array('TrackableCreator', 'TrackableUpdater')), false);
}
}
/**
* tearDown method
*
* @return void
*/
public function tearDown() {
Current::$current = array();
parent::tearDown();
}
/**
* ExceptionErrorのMockセット
*
* @param string $model モデル名
* @param string $mockModel Mockのモデル
* @param string $mockMethod Mockのメソッド
* @return void
*/
protected function _mockForReturnFalse($model, $mockModel, $mockMethod) {
list($mockPlugin, $mockModel) = pluginSplit($mockModel);
if ($mockModel === $model) {
$this->$model = $this->getMockForModel($mockPlugin . '.' . $mockModel, array($mockMethod));
$this->$model->expects($this->once())
->method($mockMethod)
->will($this->returnValue(false));
} else {
$this->$model->$mockModel = $this->getMockForModel($mockPlugin . '.' . $mockModel, array($mockMethod));
$this->$model->$mockModel->expects($this->once())
->method($mockMethod)
->will($this->returnValue(false));
}
}
}