Skip to content
This repository was archived by the owner on Sep 10, 2021. It is now read-only.

Commit 05b7e47

Browse files
committed
BUG: Refs #0449. Fixed the broken PgsqlExportComponent test.
The Lucense Index database is not stable because of other tests, so replaced the previous item->getItemsFromSearch by item->getName() in the tests.
1 parent a3436ba commit 05b7e47

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

core/tests/controllers/components/ExportComponentTest.php

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -98,26 +98,28 @@ public function uploadItems($userDao)
9898
* Helper function to get ItemIds as an input parameter
9999
* for ExportComponentTest::exportBitstreams
100100
*
101-
* @param UserDao $userDao
102101
* @param array $fileNames array of file names
103102
* @return array of itemIds
104103
*/
105-
public function getItemIds($userDao, $fileNames)
104+
public function getItemIds($fileNames)
106105
{
107-
$allItems = array();
108106
// 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+
114110
$itemIds = array();
115-
// process the items which pass the ITEM level policy check
111+
// process the items which pass the ITEM level policy check
116112
if(!empty($allItems))
117113
{
118-
foreach($allItems as $item)
114+
foreach($fileNames as $file)
119115
{
120-
$itemIds[] = $item->getKey();
116+
foreach($allItems as $item)
117+
{
118+
if($item->getName() == $file)
119+
{
120+
$itemIds[] = $item->getKey();
121+
}
122+
}
121123
}
122124
}
123125
return $itemIds;
@@ -144,7 +146,7 @@ public function testCreateSymlinks()
144146
$filenames = array();
145147
$filenames[] = "public.file";
146148
$filenames[] = "private.png";
147-
$itemIds = $this->getItemIds($userDao, $filenames);
149+
$itemIds = $this->getItemIds($filenames);
148150
// symlinks should not exist before export
149151
$this->assertFalse(file_exists($midas_exporttest_dir.'/'.$itemIds[0].'/public.file'));
150152
$this->assertFalse(file_exists($midas_exporttest_dir.'/'.$itemIds[1].'/private.png'));
@@ -203,7 +205,7 @@ public function testCopy()
203205
$exportCompoenent = new ExportComponent();
204206
$filenames = array();
205207
$filenames[] = "private.png";
206-
$itemIds = $this->getItemIds($userDao, $filenames);
208+
$itemIds = $this->getItemIds($filenames);
207209
// file should not exist before export
208210
$this->assertFalse(file_exists($midas_exporttest_dir.'/'.$itemIds[0].'/private.png'));
209211
// user1 export this item

0 commit comments

Comments
 (0)