Author: sb
Date: Tue Dec 11 11:48:43 2007
New Revision: 6962

Log:
- Add explicit calls to __toString() for PHP 5.1 compatiblity.

Modified:
    trunk/Workflow/ChangeLog
    trunk/Workflow/src/conditions/not.php
    trunk/Workflow/src/conditions/variable.php
    trunk/Workflow/src/interfaces/condition_boolean_set.php
    trunk/Workflow/src/interfaces/execution.php
    trunk/Workflow/src/nodes/action.php
    trunk/Workflow/src/visitors/visualization.php
    trunk/Workflow/tests/condition_test.php
    trunk/Workflow/tests/node_test.php
    trunk/Workflow/tests/visitor_visualization_test.php

Modified: trunk/Workflow/ChangeLog
==============================================================================
--- trunk/Workflow/ChangeLog [iso-8859-1] (original)
+++ trunk/Workflow/ChangeLog [iso-8859-1] Tue Dec 11 11:48:43 2007
@@ -1,3 +1,5 @@
+- Added explicit calls to __toString() for PHP 5.1 compatiblity.
+
 - Changed default value for the ezcWorkflowExecutionListener::notify() method's
   $type argument from self::::INFO to ezcWorkflowExecutionListener::INFO to 
work
   around an issue in PHP 5.1's Reflection API that breaks the test suite.

Modified: trunk/Workflow/src/conditions/not.php
==============================================================================
--- trunk/Workflow/src/conditions/not.php [iso-8859-1] (original)
+++ trunk/Workflow/src/conditions/not.php [iso-8859-1] Tue Dec 11 11:48:43 2007
@@ -73,7 +73,7 @@
      */
     public function __toString()
     {
-        return '! ' . (string) $this->condition;
+        return '! ' . $this->condition->__toString();
     }
 }
 ?>

Modified: trunk/Workflow/src/conditions/variable.php
==============================================================================
--- trunk/Workflow/src/conditions/variable.php [iso-8859-1] (original)
+++ trunk/Workflow/src/conditions/variable.php [iso-8859-1] Tue Dec 11 11:48:43 
2007
@@ -65,7 +65,7 @@
      */
     public function __toString()
     {
-        return $this->variableName . ' ' . (string)$this->condition;
+        return $this->variableName . ' ' . $this->condition->__toString();
     }
 
     /**

Modified: trunk/Workflow/src/interfaces/condition_boolean_set.php
==============================================================================
--- trunk/Workflow/src/interfaces/condition_boolean_set.php [iso-8859-1] 
(original)
+++ trunk/Workflow/src/interfaces/condition_boolean_set.php [iso-8859-1] Tue 
Dec 11 11:48:43 2007
@@ -83,7 +83,7 @@
                 $string .= ' ' . $this->concatenation . ' ';
             }
 
-            $string .= (string) $condition;
+            $string .= $condition->__toString();
         }
 
         return $string . ' )';

Modified: trunk/Workflow/src/interfaces/execution.php
==============================================================================
--- trunk/Workflow/src/interfaces/execution.php [iso-8859-1] (original)
+++ trunk/Workflow/src/interfaces/execution.php [iso-8859-1] Tue Dec 11 
11:48:43 2007
@@ -337,7 +337,7 @@
                 }
                 else
                 {
-                    $errors[$variableName] = 
(string)$this->waitingFor[$variableName]['condition'];
+                    $errors[$variableName] = 
$this->waitingFor[$variableName]['condition']->__toString();
                 }
             }
         }

Modified: trunk/Workflow/src/nodes/action.php
==============================================================================
--- trunk/Workflow/src/nodes/action.php [iso-8859-1] (original)
+++ trunk/Workflow/src/nodes/action.php [iso-8859-1] Tue Dec 11 11:48:43 2007
@@ -198,7 +198,7 @@
             return $e->getMessage();
         }
 
-        return (string)$object;
+        return $object->__toString();
     }
 
     /**

Modified: trunk/Workflow/src/visitors/visualization.php
==============================================================================
--- trunk/Workflow/src/visitors/visualization.php [iso-8859-1] (original)
+++ trunk/Workflow/src/visitors/visualization.php [iso-8859-1] Tue Dec 11 
11:48:43 2007
@@ -15,7 +15,7 @@
  * <code>
  *  $visitor = new ezcWorkflowVisitorVisualization;
  *  $workflow->accept( $visitor );
- *  echo (string)$visitor; // print the plot
+ *  print $visitor;
  * </code>
  *
  * @package Workflow
@@ -83,7 +83,7 @@
 
             if ( !isset( $this->nodes[ $id ] ) )
             {
-                $this->nodes[ $id ] = (string)$visitable;
+                $this->nodes[ $id ] = $visitable->__toString();
             }
 
             $outNodes = array();
@@ -98,7 +98,7 @@
 
                     if ( $condition !== false )
                     {
-                        $label = ' [label="' . (string) $condition . '"]';
+                        $label = ' [label="' . $condition->__toString() . '"]';
                     }
                 }
 

Modified: trunk/Workflow/tests/condition_test.php
==============================================================================
--- trunk/Workflow/tests/condition_test.php [iso-8859-1] (original)
+++ trunk/Workflow/tests/condition_test.php [iso-8859-1] Tue Dec 11 11:48:43 
2007
@@ -23,7 +23,7 @@
         $condition = new ezcWorkflowConditionIsAnything;
 
         $this->assertTrue( $condition->evaluate( null ) );
-        $this->assertEquals( 'is anything', (string) $condition );
+        $this->assertEquals( 'is anything', $condition->__toString() );
     }
 
     public function testIsArray()
@@ -32,7 +32,7 @@
 
         $this->assertTrue( $condition->evaluate( array() ) );
         $this->assertFalse( $condition->evaluate( null ) );
-        $this->assertEquals( 'is array', (string) $condition );
+        $this->assertEquals( 'is array', $condition->__toString() );
     }
 
     public function testIsBool()
@@ -42,7 +42,7 @@
         $this->assertTrue( $condition->evaluate( true ) );
         $this->assertTrue( $condition->evaluate( false ) );
         $this->assertFalse( $condition->evaluate( null ) );
-        $this->assertEquals( 'is bool', (string) $condition );
+        $this->assertEquals( 'is bool', $condition->__toString() );
     }
 
     public function testIsTrue()
@@ -51,7 +51,7 @@
 
         $this->assertTrue( $condition->evaluate( true ) );
         $this->assertFalse( $condition->evaluate( false ) );
-        $this->assertEquals( 'is true', (string) $condition );
+        $this->assertEquals( 'is true', $condition->__toString() );
     }
 
     public function testIsFalse()
@@ -60,7 +60,7 @@
 
         $this->assertFalse( $condition->evaluate( true ) );
         $this->assertTrue( $condition->evaluate( false ) );
-        $this->assertEquals( 'is false', (string) $condition );
+        $this->assertEquals( 'is false', $condition->__toString() );
     }
 
     public function testIsFloat()
@@ -69,7 +69,7 @@
 
         $this->assertTrue( $condition->evaluate( 0.0 ) );
         $this->assertFalse( $condition->evaluate( null ) );
-        $this->assertEquals( 'is float', (string) $condition );
+        $this->assertEquals( 'is float', $condition->__toString() );
     }
 
     public function testIsInteger()
@@ -78,7 +78,7 @@
 
         $this->assertTrue( $condition->evaluate( 0 ) );
         $this->assertFalse( $condition->evaluate( null ) );
-        $this->assertEquals( 'is integer', (string) $condition );
+        $this->assertEquals( 'is integer', $condition->__toString() );
     }
 
     public function testIsObject()
@@ -87,7 +87,7 @@
 
         $this->assertTrue( $condition->evaluate( new StdClass ) );
         $this->assertFalse( $condition->evaluate( null ) );
-        $this->assertEquals( 'is object', (string) $condition );
+        $this->assertEquals( 'is object', $condition->__toString() );
     }
 
     public function testIsString()
@@ -96,7 +96,7 @@
 
         $this->assertTrue( $condition->evaluate( '' ) );
         $this->assertFalse( $condition->evaluate( null ) );
-        $this->assertEquals( 'is string', (string) $condition );
+        $this->assertEquals( 'is string', $condition->__toString() );
     }
 
     public function testIsEqual()
@@ -105,7 +105,7 @@
 
         $this->assertTrue( $condition->evaluate( 2204 ) );
         $this->assertFalse( $condition->evaluate( 1978 ) );
-        $this->assertEquals( '== 2204', (string) $condition );
+        $this->assertEquals( '== 2204', $condition->__toString() );
     }
 
     public function testIsNotEqual()
@@ -114,7 +114,7 @@
 
         $this->assertTrue( $condition->evaluate( 1978 ) );
         $this->assertFalse( $condition->evaluate( 2204 ) );
-        $this->assertEquals( '!= 2204', (string) $condition );
+        $this->assertEquals( '!= 2204', $condition->__toString() );
     }
 
     public function testIsLessThan()
@@ -123,7 +123,7 @@
 
         $this->assertTrue( $condition->evaluate( 1978 ) );
         $this->assertFalse( $condition->evaluate( 2204 ) );
-        $this->assertEquals( '< 2204', (string) $condition );
+        $this->assertEquals( '< 2204', $condition->__toString() );
     }
 
     public function testIsNotLessThan()
@@ -134,7 +134,7 @@
 
         $this->assertTrue( $condition->evaluate( 2204 ) );
         $this->assertFalse( $condition->evaluate( 1978 ) );
-        $this->assertEquals( '! < 2204', (string) $condition );
+        $this->assertEquals( '! < 2204', $condition->__toString() );
         $this->assertType( 'ezcWorkflowConditionIsLessThan', 
$condition->getCondition() );
     }
 
@@ -144,7 +144,7 @@
 
         $this->assertTrue( $condition->evaluate( 2204 ) );
         $this->assertFalse( $condition->evaluate( 1978 ) );
-        $this->assertEquals( '> 1978', (string) $condition );
+        $this->assertEquals( '> 1978', $condition->__toString() );
     }
 
     public function testIsNotGreaterThan()
@@ -155,7 +155,7 @@
 
         $this->assertTrue( $condition->evaluate( 1978 ) );
         $this->assertFalse( $condition->evaluate( 2204 ) );
-        $this->assertEquals( '! > 1978', (string) $condition );
+        $this->assertEquals( '! > 1978', $condition->__toString() );
         $this->assertType( 'ezcWorkflowConditionIsGreaterThan', 
$condition->getCondition() );
     }
 
@@ -166,7 +166,7 @@
         $this->assertTrue( $condition->evaluate( 1 ) );
         $this->assertTrue( $condition->evaluate( 2 ) );
         $this->assertFalse( $condition->evaluate( 0 ) );
-        $this->assertEquals( '>= 1', (string) $condition );
+        $this->assertEquals( '>= 1', $condition->__toString() );
     }
 
     public function testIsEqualOrLessThan()
@@ -176,7 +176,7 @@
         $this->assertTrue( $condition->evaluate( 1 ) );
         $this->assertTrue( $condition->evaluate( 0 ) );
         $this->assertFalse( $condition->evaluate( 2 ) );
-        $this->assertEquals( '<= 1', (string) $condition );
+        $this->assertEquals( '<= 1', $condition->__toString() );
     }
 
     public function testVariable()
@@ -237,7 +237,7 @@
 
         $condition = new ezcWorkflowConditionAnd( array( $true, $true ) );
         $this->assertTrue( $condition->evaluate( true ) );
-        $this->assertEquals( '( is true && is true )', (string)$condition );
+        $this->assertEquals( '( is true && is true )', 
$condition->__toString() );
 
         $condition = new ezcWorkflowConditionAnd( array( $true, $true ) );
         $this->assertFalse( $condition->evaluate( false ) );
@@ -265,7 +265,7 @@
         $condition = new ezcWorkflowConditionOr( array( $true, $true ) );
         $this->assertTrue( $condition->evaluate( true ) );
         $this->assertFalse( $condition->evaluate( false ) );
-        $this->assertEquals( '( is true || is true )', (string)$condition );
+        $this->assertEquals( '( is true || is true )', 
$condition->__toString() );
 
         $condition = new ezcWorkflowConditionOr( array( $true, $false ) );
         $this->assertTrue( $condition->evaluate( true ) );
@@ -280,7 +280,7 @@
         $condition = new ezcWorkflowConditionXor( array( $true, $false ) );
         $this->assertTrue( $condition->evaluate( true ) );
         $this->assertTrue( $condition->evaluate( false ) );
-        $this->assertEquals( '( is true XOR is false )', (string)$condition );
+        $this->assertEquals( '( is true XOR is false )', 
$condition->__toString() );
 
         $condition = new ezcWorkflowConditionXor( array( $true, $true ) );
         $this->assertFalse( $condition->evaluate( true ) );

Modified: trunk/Workflow/tests/node_test.php
==============================================================================
--- trunk/Workflow/tests/node_test.php [iso-8859-1] (original)
+++ trunk/Workflow/tests/node_test.php [iso-8859-1] Tue Dec 11 11:48:43 2007
@@ -23,13 +23,13 @@
     public function testActionClassNotFound()
     {
         $action = new ezcWorkflowNodeAction( 'NotExistingClass' );
-        $this->assertEquals( 'Class not found.', (string)$action );
+        $this->assertEquals( 'Class not found.', $action->__toString() );
     }
 
     public function testActionClassNotServiceObject()
     {
         $action = new ezcWorkflowNodeAction( 'StdClass' );
-        $this->assertEquals( 'Class does not implement the 
ezcWorkflowServiceObject interface.', (string)$action );
+        $this->assertEquals( 'Class does not implement the 
ezcWorkflowServiceObject interface.', $action->__toString() );
     }
 
     public function testInputConstructor()
@@ -135,8 +135,8 @@
 
         $outNodes = $this->branchNode->getOutNodes();
 
-        $this->assertEquals( 'condition is true', 
(string)$this->branchNode->getCondition( $outNodes[0] ) );
-        $this->assertEquals( 'condition is false', 
(string)$this->branchNode->getCondition( $outNodes[1] ) );
+        $this->assertEquals( 'condition is true', 
$this->branchNode->getCondition( $outNodes[0] )->__toString() );
+        $this->assertEquals( 'condition is false', 
$this->branchNode->getCondition( $outNodes[1] )->__toString() );
     }
 
     public function testBranchGetCondition2()
@@ -174,8 +174,8 @@
     {
         $this->setUpEmptyWorkflow();
 
-        $this->assertEquals( 'Start', (string)$this->startNode );
-        $this->assertEquals( 'End', (string)$this->endNode );
+        $this->assertEquals( 'Start', $this->startNode->__toString() );
+        $this->assertEquals( 'End', $this->endNode->__toString() );
     }
 
     public function testStartVerifyFails()

Modified: trunk/Workflow/tests/visitor_visualization_test.php
==============================================================================
--- trunk/Workflow/tests/visitor_visualization_test.php [iso-8859-1] (original)
+++ trunk/Workflow/tests/visitor_visualization_test.php [iso-8859-1] Tue Dec 11 
11:48:43 2007
@@ -36,7 +36,7 @@
 
         $this->assertEquals(
           $this->readExpected( 'StartEnd' ),
-          (string)$this->visitor
+          $this->visitor->__toString()
         );
     }
 
@@ -47,7 +47,7 @@
 
         $this->assertEquals(
           $this->readExpected( 'StartInputEnd' ),
-          (string)$this->visitor
+          $this->visitor->__toString()
         );
     }
 
@@ -58,7 +58,7 @@
 
         $this->assertEquals(
           $this->readExpected( 'StartSetEnd' ),
-          (string)$this->visitor
+          $this->visitor->__toString()
         );
     }
 
@@ -69,7 +69,7 @@
 
         $this->assertEquals(
           $this->readExpected( 'StartSetUnsetEnd' ),
-          (string)$this->visitor
+          $this->visitor->__toString()
         );
     }
 
@@ -80,7 +80,7 @@
 
         $this->assertEquals(
           $this->readExpected( 'IncrementingLoop' ),
-          (string)$this->visitor
+          $this->visitor->__toString()
         );
     }
 
@@ -91,7 +91,7 @@
 
         $this->assertEquals(
           $this->readExpected( 'DecrementingLoop' ),
-          (string)$this->visitor
+          $this->visitor->__toString()
         );
     }
 
@@ -102,7 +102,7 @@
 
         $this->assertEquals(
           $this->readExpected( 'SetAddSubMulDiv' ),
-          (string)$this->visitor
+          $this->visitor->__toString()
         );
     }
 
@@ -113,7 +113,7 @@
 
         $this->assertEquals(
           $this->readExpected( 'AddVariables' ),
-          (string)$this->visitor
+          $this->visitor->__toString()
         );
     }
 
@@ -124,7 +124,7 @@
 
         $this->assertEquals(
           $this->readExpected( 'VariableEqualsVariable' ),
-          (string)$this->visitor
+          $this->visitor->__toString()
         );
     }
 
@@ -135,7 +135,7 @@
 
         $this->assertEquals(
           $this->readExpected( 'ParallelSplitSynchronization' ),
-          (string)$this->visitor
+          $this->visitor->__toString()
         );
     }
 
@@ -146,7 +146,7 @@
 
         $this->assertEquals(
           $this->readExpected( 'ParallelSplitSynchronization2' ),
-          (string)$this->visitor
+          $this->visitor->__toString()
         );
     }
 
@@ -157,7 +157,7 @@
 
         $this->assertEquals(
           $this->readExpected( 'ExclusiveChoiceSimpleMerge' ),
-          (string)$this->visitor
+          $this->visitor->__toString()
         );
     }
 
@@ -168,7 +168,7 @@
 
         $this->assertEquals(
           $this->readExpected( 
'ExclusiveChoiceWithUnconditionalOutNodeSimpleMerge' ),
-          (string)$this->visitor
+          $this->visitor->__toString()
         );
     }
 
@@ -179,7 +179,7 @@
 
         $this->assertEquals(
           $this->readExpected( 'NestedExclusiveChoiceSimpleMerge' ),
-          (string)$this->visitor
+          $this->visitor->__toString()
         );
     }
 
@@ -190,7 +190,7 @@
 
         $this->assertEquals(
           $this->readExpected( 'MultiChoiceSynchronizingMerge' ),
-          (string)$this->visitor
+          $this->visitor->__toString()
         );
     }
 
@@ -201,7 +201,7 @@
 
         $this->assertEquals(
           $this->readExpected( 'MultiChoiceDiscriminator' ),
-          (string)$this->visitor
+          $this->visitor->__toString()
         );
     }
 
@@ -212,7 +212,7 @@
 
         $this->assertEquals(
           $this->readExpected( 'WorkflowWithSubWorkflow' ),
-          (string)$this->visitor
+          $this->visitor->__toString()
         );
     }
 
@@ -223,7 +223,7 @@
 
         $this->assertEquals(
           $this->readExpected( 'NestedLoops' ),
-          (string)$this->visitor
+          $this->visitor->__toString()
         );
     }
 


-- 
svn-components mailing list
svn-components@lists.ez.no
http://lists.ez.no/mailman/listinfo/svn-components

Reply via email to