commit b9870a05e4788f5f223d6ac7a16834584f4232f7
parent c67145a43ba8f2ff0ff971431a6aa39cdbe19468
Author: Felicitus <felicitus@felicitus.org>
Date: Sun, 25 Mar 2012 03:34:09 +0200
Added testcase for commit 24c0c6a8a47bfc2d683dce03c3b7259807b528a6
Diffstat:
2 files changed, 36 insertions(+), 3 deletions(-)
diff --git a/tests/Part/PartServiceTest.php b/tests/Part/PartServiceTest.php
@@ -38,6 +38,26 @@ class PartServiceTest extends \PHPUnit_Framework_TestCase {
$service->create();
}
+ /**
+ * Tests if a part with an initial stock level > 0 is created correctly.
+ *
+ * This was fixed with
+ */
+ public function testCreatePartWithInitialStockLevel () {
+ $partName = "testCreatePartWithInitialStockLevel";
+
+ $part = array(
+ "name" => $partName,
+ "initialStockLevel" => 1,
+ "category" => 1,
+ "initialStockLevelUser" => 1,
+ "storageLocation" => self::$storageLocation
+ );
+
+ $service = new PartService($part);
+ $service->create();
+ }
+
/**
* @expectedException de\RaumZeitLabor\PartKeepr\Part\Exceptions\StorageLocationNotAssignedException
*/
diff --git a/tests/bootstrap.php b/tests/bootstrap.php
@@ -2,7 +2,8 @@
namespace de\RaumZeitLabor\PartKeepr\Tests;
use de\RaumZeitLabor\PartKeepr\PartCategory\PartCategoryManager,
- de\raumzeitlabor\PartKeepr\PartKeepr;
+ de\RaumZeitLabor\PartKeepr\PartKeepr,
+ de\RaumZeitLabor\PartKeepr\User\User;
include(dirname(__DIR__). "/src/backend/de/RaumZeitLabor/PartKeepr/PartKeepr.php");
@@ -14,4 +15,16 @@ $classes = PartKeepr::getClassMetaData();
$tool->dropSchema($classes);
$tool->createSchema($classes);
-PartCategoryManager::getInstance()->ensureRootExists();-
\ No newline at end of file
+/* Some very basic installation things */
+PartCategoryManager::getInstance()->ensureRootExists();
+
+/* Create a blank admin user */
+$user = new User();
+$user->setUsername("admin");
+$user->setPassword("admin");
+$user->setAdmin(true);
+
+PartKeepr::getEM()->persist($user);
+
+
+PartKeepr::getEM()->flush();+
\ No newline at end of file