-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathDeleteGroupTest.php
More file actions
73 lines (67 loc) · 1.62 KB
/
DeleteGroupTest.php
File metadata and controls
73 lines (67 loc) · 1.62 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
/**
* Group::deleteGroup()のテスト
*
* @author Noriko Arai <arai@nii.ac.jp>
* @author Yuna Miyashita <butackle@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('GroupsModelTestBase', 'Groups.Test/Case');
/**
* Group::deleteGroup()のテスト
*
* @author Yuna Miyashita <butackle@gmail.com>
* @package NetCommons\Groups\Test\Case\Model\Group
*/
class GroupDeleteGroupUserTest extends GroupsModelTestBase {
/**
* deleteGroup()のテスト
*
* @dataProvider dataProviderDeleteGroup
* @param int $groupId 削除対象グループID
* @param string exception 想定しているexception
* @return void
*/
public function testDeleteGroup($groupId = [], $exception = null) {
if (!is_null($exception)) {
$this->setExpectedException($exception);
}
$result = $this->_classGroup->deleteGroup($groupId);
$this->assertTrue(
$result, 'セーブ結果が想定と異なります。'
);
$this->assertEqual(
0,
$this->_group->find('count'),
'データ登録数が想定と異なります。'
);
}
/**
* testDeleteGroup用dataProvider
*
* ### 戻り値
* - groupId: 削除対象グループID
* - exception: 想定しているexception
*/
public function dataProviderDeleteGroup() {
return array(
array(
1, null
),
//NULL
array(
null, 'InternalErrorException'
),
//存在しないgroupId
array(
9999, 'InternalErrorException'
),
//文字列のgroupId
array(
'Error', 'InternalErrorException'
),
);
}
}