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

Commit 5e1fb61

Browse files
author
Charles Marion
committed
BUG: fixed tests
1 parent 23a68f0 commit 5e1fb61

File tree

5 files changed

+28
-16
lines changed

5 files changed

+28
-16
lines changed

core/controllers/forms/UserForm.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ public function createAccountForm($defaultValue = array())
190190
$biography->setValue($defaultValue['biography']);
191191
}
192192

193-
$form->addElements(array($website, $city ,$country, $biography, $firstname, $lastname, $company, $privacy, $submit));
193+
$form->addElements(array($website, $city, $country, $biography, $firstname, $lastname, $company, $privacy, $submit));
194194

195195
return $form;
196196
}

core/models/base/ItemRevisionModelBase.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function __construct()
4242
abstract function getByUuid($uuid);
4343
abstract function getMetadata($revisiondao);
4444

45-
/** Add a bitstream to a revision */
45+
/** Add a bitstream to a revision */
4646
function addBitstream($itemRevisionDao, $bitstreamDao)
4747
{
4848
$modelLoad = new MIDAS_ModelLoader();
@@ -77,7 +77,7 @@ function addBitstream($itemRevisionDao, $bitstreamDao)
7777
{
7878
$src = imagecreatefromjpeg($tmpfile);
7979
}
80-
catch (Exception $exc)
80+
catch(Exception $exc)
8181
{
8282
$createThumb = false;
8383
}
@@ -88,7 +88,7 @@ function addBitstream($itemRevisionDao, $bitstreamDao)
8888
{
8989
$src = imagecreatefrompng($tmpfile);
9090
}
91-
catch (Exception $exc)
91+
catch(Exception $exc)
9292
{
9393
$createThumb = false;
9494
}
@@ -99,7 +99,7 @@ function addBitstream($itemRevisionDao, $bitstreamDao)
9999
{
100100
$src = imagecreatefromgif($tmpfile);
101101
}
102-
catch (Exception $exc)
102+
catch(Exception $exc)
103103
{
104104
$createThumb = false;
105105
}
@@ -130,9 +130,9 @@ function addBitstream($itemRevisionDao, $bitstreamDao)
130130
{
131131
$destionation = $tmpPath."/".rand(1, 1000).'.jpeg';
132132
}
133-
$pathThumbnail=$destionation;
133+
$pathThumbnail = $destionation;
134134

135-
list ($x, $y) = @getimagesize ($tmpfile); //--- get size of img ---
135+
list ($x, $y) = getimagesize($tmpfile); //--- get size of img ---
136136
$thumb = 100; //--- max. size of thumb ---
137137
if($x > $y)
138138
{
@@ -145,11 +145,11 @@ function addBitstream($itemRevisionDao, $bitstreamDao)
145145
$ty = $thumb;
146146
}
147147

148-
$thb = imagecreatetruecolor ($tx, $ty); //--- create thumbnail ---
149-
imagecopyresampled ($thb,$src, 0,0, 0,0, $tx,$ty, $x,$y);
150-
imagejpeg ($thb, $pathThumbnail, 80);
151-
imagedestroy ($thb);
152-
imagedestroy ($src);
148+
$thb = imagecreatetruecolor($tx, $ty); //--- create thumbnail ---
149+
imagecopyresampled($thb, $src, 0, 0, 0, 0, $tx, $ty, $x, $y);
150+
imagejpeg($thb, $pathThumbnail, 80);
151+
imagedestroy($thb);
152+
imagedestroy($src);
153153
}
154154
}
155155
else
@@ -174,7 +174,7 @@ function addBitstream($itemRevisionDao, $bitstreamDao)
174174
{
175175
unlink($oldThumbnail);
176176
}
177-
$item->setThumbnail(substr($pathThumbnail, strlen(BASE_PATH)+1));
177+
$item->setThumbnail(substr($pathThumbnail, strlen(BASE_PATH) + 1));
178178
}
179179
$ItemModel->save($item);
180180
} // end addBitstream

tests/core/ControllerTestCase.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,15 @@ public function setupDatabase($files)
187187
$databaseFixture = new PHPUnit_Extensions_Database_DataSet_FlatXmlDataSet( dirname(__FILE__) . '/../databaseDataset/'.$files.'.xml');
188188
$databaseTester->setupDatabase($databaseFixture);
189189
}
190+
191+
if($configDatabase->database->adapter == 'PDO_PGSQL')
192+
{
193+
$db->query("SELECT setval('feed_feed_id_seq', (SELECT MAX(feed_id) FROM feed)+1);");
194+
$db->query("SELECT setval('user_user_id_seq', (SELECT MAX(user_id) FROM \"user\")+1);");
195+
$db->query("SELECT setval('item_item_id_seq', (SELECT MAX(item_id) FROM item)+1);");
196+
$db->query("SELECT setval('itemrevision_itemrevision_id_seq', (SELECT MAX(itemrevision_id) FROM itemrevision)+1);");
197+
$db->query("SELECT setval('folder_folder_id_seq', (SELECT MAX(folder_id) FROM folder)+1);");
198+
}
190199
}
191200

192201
/**

tests/core/DatabaseTestCase.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ public function setupDatabase($files)
4444
if($configDatabase->database->adapter == 'PDO_PGSQL')
4545
{
4646
$db->query("SELECT setval('feed_feed_id_seq', (SELECT MAX(feed_id) FROM feed)+1);");
47+
$db->query("SELECT setval('user_user_id_seq', (SELECT MAX(user_id) FROM \"user\")+1);");
48+
$db->query("SELECT setval('item_item_id_seq', (SELECT MAX(item_id) FROM item)+1);");
49+
$db->query("SELECT setval('itemrevision_itemrevision_id_seq', (SELECT MAX(itemrevision_id) FROM itemrevision)+1);");
4750
$db->query("SELECT setval('folder_folder_id_seq', (SELECT MAX(folder_id) FROM folder)+1);");
4851
}
4952

tests/core/models/CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ add_subdirectory( dao )
44
#Style
55
add_midas_style_test( StyleCoreModelsBase ${CMAKE_SOURCE_DIR}/core/models/base/ )
66
add_midas_style_test( StyleCoreModelsPdo ${CMAKE_SOURCE_DIR}/core/models/pdo/ )
7-
add_midas_style_test( StyleCoreModelsPdo ${CMAKE_SOURCE_DIR}/core/models/cassandra/ )
7+
add_midas_style_test( StyleCoreModelsCassandra ${CMAKE_SOURCE_DIR}/core/models/cassandra/ )
88
add_midas_style_test( StyleCoreModelsDao ${CMAKE_SOURCE_DIR}/core/models/dao/ )
9-
add_midas_style_test( StyleCoreModelsDao ${CMAKE_SOURCE_DIR}/core/models/AppDao.php )
10-
add_midas_style_test( StyleCoreModelsDao ${CMAKE_SOURCE_DIR}/core/models/AppModel.php )
9+
add_midas_style_test( StyleCoreModelsAppDao ${CMAKE_SOURCE_DIR}/core/models/AppDao.php )
10+
add_midas_style_test( StyleCoreModelsAppModel ${CMAKE_SOURCE_DIR}/core/models/AppModel.php )

0 commit comments

Comments
 (0)