Author: Tobias Schlitt
Date: 2006-09-24 22:49:23 +0200 (Sun, 24 Sep 2006)
New Revision: 3565
Log:
- Reformat test cases.
- Add more test cases.
Modified:
trunk/ConsoleTools/tests/output_format_test.php
trunk/ConsoleTools/tests/output_formats_test.php
Modified: trunk/ConsoleTools/tests/output_format_test.php
===================================================================
--- trunk/ConsoleTools/tests/output_format_test.php 2006-09-24 20:37:46 UTC
(rev 3564)
+++ trunk/ConsoleTools/tests/output_format_test.php 2006-09-24 20:49:23 UTC
(rev 3565)
@@ -145,7 +145,22 @@
}
$this->fail( "Exception not thrown on set of not existing color on
ezcConsoleFormat->bgcolor." );
}
+
+ public function testSetAccessFailureNonexistent()
+ {
+ $format = new ezcConsoleOutputFormat();
+ try
+ {
+ $format->nonExsitent = "nonExistent";
+ }
+ catch ( ezcBasePropertyNotFoundException $e )
+ {
+ return true;
+ }
+ $this->fail( "Exception not thrown on set of not existing color on
ezcConsoleFormat->bgcolor." );
+ }
+
public function testIssetAccessSuccess()
{
$format = new ezcConsoleOutputFormat();
Modified: trunk/ConsoleTools/tests/output_formats_test.php
===================================================================
--- trunk/ConsoleTools/tests/output_formats_test.php 2006-09-24 20:37:46 UTC
(rev 3564)
+++ trunk/ConsoleTools/tests/output_formats_test.php 2006-09-24 20:49:23 UTC
(rev 3565)
@@ -23,52 +23,75 @@
return new ezcTestSuite( "ezcConsoleToolsOutputFormatsTest" );
}
- /**
- * testConstructor
- */
public function testConstructor()
{
- $fake = new ezcConsoleOutputFormats();
- $fake->default = new ezcConsoleOutputFormat();
+ $formats = new ezcConsoleOutputFormats();
+ $formats->default = new ezcConsoleOutputFormat();
$this->assertEquals(
- $fake,
+ $formats,
new ezcConsoleOutputFormats(),
'Default values incorrect for ezcConsoleOutputFormats.'
);
}
- /**
- * Test on the fly creation with __get()
- */
- public function testGet()
+ public function testGetAccessNonExistent()
{
- $form = new ezcConsoleOutputFormats();
- $fake = new ezcConsoleOutputFormat();
+ $formats = new ezcConsoleOutputFormats();
+ $format = new ezcConsoleOutputFormat();
$this->assertEquals(
- $fake,
- $form->foobar,
- 'On the fly creation of ezcConsoleOutputFormat failed.'
+ $format,
+ $formats->foobar
);
}
- /**
- * Test on the fly creation with __set()
- */
- public function testGetManipulate()
+ public function testGetAccessExistent()
{
- $form = new ezcConsoleOutputFormats();
- $form->foobar->color = 'blue';
+ $formats = new ezcConsoleOutputFormats();
+ $format = new ezcConsoleOutputFormat();
+ $formats->foobar = $format;
+ $this->assertEquals(
+ $format,
+ $formats->foobar
+ );
+ }
+
+ public function testGetAccessManipulate()
+ {
+ $formats = new ezcConsoleOutputFormats();
+ $formats->foobar->color = 'blue';
- $fake = new ezcConsoleOutputFormat();
- $fake->color = 'blue';
+ $format = new ezcConsoleOutputFormat();
+ $format->color = 'blue';
$this->assertEquals(
- $fake,
- $form->foobar,
- 'Manipulation of ezcConsoleOutputFormat failed.'
+ $format,
+ $formats->foobar
);
}
+ public function testSetAccessExistent()
+ {
+ $formats = new ezcConsoleOutputFormats();
+ $format = new ezcConsoleOutputFormat();
+ $formats->foobar = $format;
+ $this->assertEquals(
+ $format,
+ $formats->foobar
+ );
+ }
+
+ public function testIssetAccessSuccess()
+ {
+ $formats = new ezcConsoleOutputFormats();
+ $formats->foobar = new ezcConsoleOutputFormat();
+ $this->assertTrue( isset( $formats->foobar ) );
+ }
+
+ public function testIssetAccessFailure()
+ {
+ $formats = new ezcConsoleOutputFormats();
+ $this->assertFalse( isset( $formats->foobar ) );
+ }
}
?>
--
svn-components mailing list
[email protected]
http://lists.ez.no/mailman/listinfo/svn-components