-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDownloadTest.php
More file actions
108 lines (96 loc) · 2.14 KB
/
DownloadTest.php
File metadata and controls
108 lines (96 loc) · 2.14 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
<?php
/**
* CabinetFilesController::download()のテスト
*
* @author Noriko Arai <arai@nii.ac.jp>
* @author Ryuji AMANO <ryuji@ryus.co.jp>
* @link http://www.netcommons.org NetCommons Project
* @license http://www.netcommons.org/license.txt NetCommons License
* @copyright Copyright 2014, NetCommons Project
*/
App::uses('NetCommonsControllerTestCase', 'NetCommons.TestSuite');
/**
* CabinetFilesController::view()のテスト
*
* @author Ryuji AMANO <ryuji@ryus.co.jp>
* @package NetCommons\Cabinets\Test\Case\Controller\CabinetFilesController
*/
class CabinetFilesControllerDownloadTest extends NetCommonsControllerTestCase {
/**
* Fixtures
*
* @var array
*/
public $fixtures = array(
'plugin.cabinets.cabinet',
'plugin.cabinets.cabinet_file',
'plugin.cabinets.cabinet_file_tree',
'plugin.cabinets.block_setting_for_cabinet',
'plugin.workflow.workflow_comment',
'plugin.authorization_keys.authorization_keys',
'plugin.site_manager.site_setting',
'plugin.cabinets.upload_file_for_cabinets',
'plugin.cabinets.upload_files_content_for_cabinets',
);
/**
* Plugin name
*
* @var string
*/
public $plugin = 'cabinets';
/**
* Controller name
*
* @var string
*/
protected $_controller = 'cabinet_files';
/**
* テストDataの取得
*
* @return array
*/
private function __data() {
$frameId = '6';
$blockId = '2';
$contentKey = 'content_key_1';
$data = array(
'action' => 'download',
'frame_id' => $frameId,
'block_id' => $blockId,
'key' => $contentKey,
'file'
);
return $data;
}
/**
* download()アクションのGetリクエストテスト
*
* @return void
*/
public function testDownloadGet() {
$this->generate(
'Caabinets.CabinetFiles',
[
'components' => [
'Download'
]
]
);
$this->controller->Components->Download
->expects($this->once())
->method('doDownload')
->with(
$this->equalTo(1),
$this->equalTo(
[
'field' => 'file',
'download' => true,
'name' => 'file1'
]
)
);
$urlOptions = $this->__data();
//テスト実施
$this->_testGetAction($urlOptions, array('method' => 'assertEmpty'), null, 'result');
}
}