summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorKore Nordmann <github@kore-nordmann.de>2007-01-25 15:44:09 +0000
committerKore Nordmann <github@kore-nordmann.de>2007-01-25 15:44:09 +0000
commit0160678109ddc1f4887b2c06df73a6de827c9bd2 (patch)
treeb4efaf33887d1959e29983dd21037d908d861029 /tests
parentc5b1b0f5d7b7ef32d1930a217e569699d2551374 (diff)
downloadzetacomponents-graph-0160678109ddc1f4887b2c06df73a6de827c9bd2.zip
zetacomponents-graph-0160678109ddc1f4887b2c06df73a6de827c9bd2.tar.gz
- Always return $this, to enable "fluent interfaces"
Diffstat (limited to 'tests')
-rw-r--r--tests/vector_test.php42
1 files changed, 36 insertions, 6 deletions
diff --git a/tests/vector_test.php b/tests/vector_test.php
index a3cb429..73ecd02 100644
--- a/tests/vector_test.php
+++ b/tests/vector_test.php
@@ -65,7 +65,7 @@ class ezcGraphVectorTest extends ezcTestCase
public function testUnifyVector()
{
$vector = new ezcGraphVector( 2, 0 );
- $vector->unify();
+ $result = $vector->unify();
$this->assertEquals(
1,
@@ -76,12 +76,18 @@ class ezcGraphVectorTest extends ezcTestCase
0,
$vector->y
);
+
+ $this->assertEquals(
+ $result,
+ $vector,
+ 'Result should be the vector itself'
+ );
}
public function testVectorMultiplyScalar()
{
$vector = new ezcGraphVector( 1, 2 );
- $vector->scalar( 2 );
+ $result = $vector->scalar( 2 );
$this->assertEquals(
2,
@@ -92,6 +98,12 @@ class ezcGraphVectorTest extends ezcTestCase
4,
$vector->y
);
+
+ $this->assertEquals(
+ $result,
+ $vector,
+ 'Result should be the vector itself'
+ );
}
public function testVectorMultiplyCoordinate()
@@ -119,7 +131,7 @@ class ezcGraphVectorTest extends ezcTestCase
public function testVectorAddCoordinate()
{
$vector = new ezcGraphVector( 1, 2 );
- $vector->add( new ezcGraphCoordinate( 3, 2 ) );
+ $result = $vector->add( new ezcGraphCoordinate( 3, 2 ) );
$this->assertEquals(
$vector,
@@ -130,34 +142,52 @@ class ezcGraphVectorTest extends ezcTestCase
public function testVectorAddVector()
{
$vector = new ezcGraphVector( 1, 2 );
- $vector->add( new ezcGraphVector( 3, 2 ) );
+ $result = $vector->add( new ezcGraphVector( 3, 2 ) );
$this->assertEquals(
$vector,
new ezcGraphVector( 4, 4 )
);
+
+ $this->assertEquals(
+ $result,
+ $vector,
+ 'Result should be the vector itself'
+ );
}
public function testVectorSubCoordinate()
{
$vector = new ezcGraphVector( 1, 2 );
- $vector->sub( new ezcGraphCoordinate( 3, 2 ) );
+ $result = $vector->sub( new ezcGraphCoordinate( 3, 2 ) );
$this->assertEquals(
$vector,
new ezcGraphVector( -2, 0 )
);
+
+ $this->assertEquals(
+ $result,
+ $vector,
+ 'Result should be the vector itself'
+ );
}
public function testVectorSubVector()
{
$vector = new ezcGraphVector( 1, 2 );
- $vector->sub( new ezcGraphVector( 3, 2 ) );
+ $result = $vector->sub( new ezcGraphVector( 3, 2 ) );
$this->assertEquals(
$vector,
new ezcGraphVector( -2, 0 )
);
+
+ $this->assertEquals(
+ $result,
+ $vector,
+ 'Result should be the vector itself'
+ );
}
}
OpenPOWER on IntegriCloud