@@ -98,26 +98,28 @@ public function uploadItems($userDao)
98
98
* Helper function to get ItemIds as an input parameter
99
99
* for ExportComponentTest::exportBitstreams
100
100
*
101
- * @param UserDao $userDao
102
101
* @param array $fileNames array of file names
103
102
* @return array of itemIds
104
103
*/
105
- public function getItemIds ($ userDao , $ fileNames )
104
+ public function getItemIds ($ fileNames )
106
105
{
107
- $ allItems = array ();
108
106
// get all the itemDaos
109
- foreach ($ fileNames as $ file )
110
- {
111
- $ items = $ this ->Item ->getItemsFromSearch ($ file , $ userDao );
112
- $ allItems = array_merge ($ allItems , $ items );
113
- }
107
+ $ allItems = array ();
108
+ $ allItems = $ this ->Item ->getAll ();
109
+
114
110
$ itemIds = array ();
115
- // process the items which pass the ITEM level policy check
111
+ // process the items which pass the ITEM level policy check
116
112
if (!empty ($ allItems ))
117
113
{
118
- foreach ($ allItems as $ item )
114
+ foreach ($ fileNames as $ file )
119
115
{
120
- $ itemIds [] = $ item ->getKey ();
116
+ foreach ($ allItems as $ item )
117
+ {
118
+ if ($ item ->getName () == $ file )
119
+ {
120
+ $ itemIds [] = $ item ->getKey ();
121
+ }
122
+ }
121
123
}
122
124
}
123
125
return $ itemIds ;
@@ -144,7 +146,7 @@ public function testCreateSymlinks()
144
146
$ filenames = array ();
145
147
$ filenames [] = "public.file " ;
146
148
$ filenames [] = "private.png " ;
147
- $ itemIds = $ this ->getItemIds ($ userDao , $ filenames );
149
+ $ itemIds = $ this ->getItemIds ($ filenames );
148
150
// symlinks should not exist before export
149
151
$ this ->assertFalse (file_exists ($ midas_exporttest_dir .'/ ' .$ itemIds [0 ].'/public.file ' ));
150
152
$ this ->assertFalse (file_exists ($ midas_exporttest_dir .'/ ' .$ itemIds [1 ].'/private.png ' ));
@@ -203,7 +205,7 @@ public function testCopy()
203
205
$ exportCompoenent = new ExportComponent ();
204
206
$ filenames = array ();
205
207
$ filenames [] = "private.png " ;
206
- $ itemIds = $ this ->getItemIds ($ userDao , $ filenames );
208
+ $ itemIds = $ this ->getItemIds ($ filenames );
207
209
// file should not exist before export
208
210
$ this ->assertFalse (file_exists ($ midas_exporttest_dir .'/ ' .$ itemIds [0 ].'/private.png ' ));
209
211
// user1 export this item
0 commit comments