@@ -71,6 +71,12 @@ public static function cleanTestFolders()
7171
7272 private function getSession ($ workspaceName = 'default ' )
7373 {
74+ static $ session = array ();
75+
76+ if (isset ($ session [$ workspaceName ])) {
77+ return $ session [$ workspaceName ];
78+ }
79+
7480 $ params = array (
7581 'jackalope.jackrabbit_uri ' => 'http://localhost:8080/server/ ' ,
7682 );
@@ -79,9 +85,9 @@ private function getSession($workspaceName = 'default')
7985 $ repository = $ factory ->getRepository ($ params );
8086 $ credentials = new SimpleCredentials ('admin ' , 'admin ' );
8187
82- $ session = $ repository ->login ($ credentials , $ workspaceName );
88+ $ session[ $ workspaceName ] = $ repository ->login ($ credentials , $ workspaceName );
8389
84- return $ session ;
90+ return $ session[ $ workspaceName ] ;
8591 }
8692
8793 private function getOutput ()
@@ -506,7 +512,11 @@ public function thereExistsAWorkspace($arg1)
506512 {
507513 $ session = $ this ->getSession ();
508514 $ workspace = $ session ->getWorkspace ();
509- $ workspace ->createWorkspace ($ arg1 );
515+ try {
516+ $ workspace ->createWorkspace ($ arg1 );
517+ } catch (\Exception $ e ) {
518+ // already exists..
519+ }
510520 }
511521
512522 /**
@@ -526,6 +536,7 @@ public function thereShouldNotExistAWorkspaceCalled($arg1)
526536 */
527537 public function theFixturesAreLoadedIntoAWorkspace ($ arg1 , $ arg2 )
528538 {
539+ $ this ->thereExistsAWorkspace ($ arg2 );
529540 $ fixtureFile = $ this ->getFixtureFilename ($ arg1 );
530541 $ session = $ this ->getSession ($ arg2 );
531542 NodeHelper::purgeWorkspace ($ session );
@@ -615,14 +626,14 @@ public function thePrimaryTypeOfShouldBe($arg1, $arg2)
615626 }
616627
617628 /**
618- * @Given /^the node at "([^"]*)" should have the property "([^"]*)" with type "([^"]*)"$/
629+ * @Given /^the node at "([^"]*)" should have the property "([^"]*)" with value "([^"]*)"$/
619630 */
620- public function theNodeAtShouldHaveThePropertyWithType ($ arg1 , $ arg2 , $ arg3 )
631+ public function theNodeAtShouldHaveThePropertyWithValue ($ arg1 , $ arg2 , $ arg3 )
621632 {
622633 $ session = $ this ->getSession ();
623634 $ node = $ session ->getNode ($ arg1 );
624635 $ property = $ node ->getProperty ($ arg2 );
625- $ propertyType = $ property ->getType ();
636+ $ propertyType = $ property ->getValue ();
626637 PHPUnit_Framework_Assert::assertEquals ($ arg3 , $ propertyType );
627638 }
628639
0 commit comments