20
20
21
21
require_once BASE_PATH .'/core/tests/controllers/api/RestCallMethodsTestCase.php ' ;
22
22
23
- /** Tests the functionality of the web API Rest Item methods */
23
+ /** Tests the functionality of the web API Rest Item methods. */
24
24
class Core_RestCallItemMethodsTest extends RestCallMethodsTestCase
25
25
{
26
- /** set up tests */
26
+ /** Set up tests. */
27
27
public function setUp ()
28
28
{
29
29
parent ::setUp ();
@@ -35,11 +35,11 @@ public function testItemAddmetadata()
35
35
$ itemsFile = $ this ->loadData ('Item ' , 'default ' );
36
36
$ itemDao = $ this ->Item ->load ($ itemsFile [1 ]->getKey ());
37
37
38
- $ apipath = '/item/addmetadata/ ' .$ itemDao ->getItemId ();
38
+ $ apiPath = '/item/addmetadata/ ' .$ itemDao ->getItemId ();
39
39
40
40
// No user will fail.
41
41
$ this ->resetAll ();
42
- $ resp = $ this ->_callRestApi ('PUT ' , $ apipath );
42
+ $ resp = $ this ->_callRestApi ('PUT ' , $ apiPath );
43
43
$ this ->_assertStatusFail ($ resp );
44
44
45
45
$ usersFile = $ this ->loadData ('User ' , 'default ' );
@@ -48,28 +48,28 @@ public function testItemAddmetadata()
48
48
// Lack of request body will fail.
49
49
$ this ->resetAll ();
50
50
$ this ->params ['useSession ' ] = 'true ' ;
51
- $ resp = $ this ->_callRestApi ('PUT ' , $ apipath , $ userDao );
51
+ $ resp = $ this ->_callRestApi ('PUT ' , $ apiPath , $ userDao );
52
52
$ this ->_assertStatusFail ($ resp );
53
53
54
54
// Request body without a 'metadata' key will fail.
55
55
$ this ->resetAll ();
56
56
$ this ->params ['useSession ' ] = 'true ' ;
57
57
$ this ->params [0 ] = json_encode (array ('murkydata ' => array ()));
58
- $ resp = $ this ->_callRestApi ('PUT ' , $ apipath , $ userDao );
58
+ $ resp = $ this ->_callRestApi ('PUT ' , $ apiPath , $ userDao );
59
59
$ this ->_assertStatusFail ($ resp );
60
60
61
61
// Metadatum needs 'value' key.
62
62
$ this ->resetAll ();
63
63
$ this ->params ['useSession ' ] = 'true ' ;
64
64
$ this ->params [0 ] = json_encode (array ('metadata ' => array ('element ' => 'key1 ' )));
65
- $ resp = $ this ->_callRestApi ('PUT ' , $ apipath , $ userDao );
65
+ $ resp = $ this ->_callRestApi ('PUT ' , $ apiPath , $ userDao );
66
66
$ this ->_assertStatusFail ($ resp );
67
67
68
68
// Metadatum needs 'element' key.
69
69
$ this ->resetAll ();
70
70
$ this ->params ['useSession ' ] = 'true ' ;
71
71
$ this ->params [0 ] = json_encode (array ('metadata ' => array ('value ' => 'val1 ' )));
72
- $ resp = $ this ->_callRestApi ('PUT ' , $ apipath , $ userDao );
72
+ $ resp = $ this ->_callRestApi ('PUT ' , $ apiPath , $ userDao );
73
73
$ this ->_assertStatusFail ($ resp );
74
74
75
75
// Write some metadata correctly.
@@ -79,7 +79,7 @@ public function testItemAddmetadata()
79
79
array ('element ' => 'key1 ' , 'value ' => 'val1 ' ),
80
80
array ('element ' => 'key2 ' , 'value ' => 'val2 ' ),
81
81
)));
82
- $ resp = $ this ->_callRestApi ('PUT ' , $ apipath , $ userDao );
82
+ $ resp = $ this ->_callRestApi ('PUT ' , $ apiPath , $ userDao );
83
83
$ this ->_assertStatusOk ($ resp );
84
84
85
85
/** @var ItemModel $itemModel */
@@ -108,7 +108,7 @@ public function testItemAddmetadata()
108
108
array ('element ' => 'key1 ' , 'value ' => 'newval1 ' ),
109
109
array ('element ' => 'key3 ' , 'value ' => 'val3 ' ),
110
110
)));
111
- $ resp = $ this ->_callRestApi ('PUT ' , $ apipath , $ userDao );
111
+ $ resp = $ this ->_callRestApi ('PUT ' , $ apiPath , $ userDao );
112
112
$ this ->_assertStatusOk ($ resp );
113
113
114
114
$ metadata = $ itemRevisionModel ->getMetadata ($ revisionDao );
0 commit comments