[Argil-svn] SF.net SVN: argil: [519] branches/experimental/tests
Status: Alpha
Brought to you by:
tswicegood
|
From: <tsw...@us...> - 2007-05-13 05:52:03
|
Revision: 519
http://argil.svn.sourceforge.net/argil/?rev=519&view=rev
Author: tswicegood
Date: 2007-05-12 22:52:03 -0700 (Sat, 12 May 2007)
Log Message:
-----------
Move all tests over to PEAR formatting standards
Modified Paths:
--------------
branches/experimental/tests/AllTest.php
branches/experimental/tests/Argil/Model/ContainerTest.php
branches/experimental/tests/Argil/Reflection/ObjectTest.php
branches/experimental/tests/Argil/Reflection/PropertyListTest.php
branches/experimental/tests/Argil/Reflection/PropertyTest.php
branches/experimental/tests/Argil/RouteTest.php
branches/experimental/tests/Argil/Specification/LengthTest.php
branches/experimental/tests/config.php
Modified: branches/experimental/tests/AllTest.php
===================================================================
--- branches/experimental/tests/AllTest.php 2007-04-05 03:27:38 UTC (rev 518)
+++ branches/experimental/tests/AllTest.php 2007-05-13 05:52:03 UTC (rev 519)
@@ -1,15 +1,14 @@
<?php
-
require_once dirname(__FILE__) . '/config.php';
-
class ArgilTestSuite extends TestSuite
{
- public function __construct() {
- $this->addTestFile('Argil/Model/ContainerTest.php');
- $this->addTestFile('Argil/Reflection/ObjectTest.php');
- $this->addTestFile('Argil/Reflection/PropertyListTest.php');
- $this->addTestFile('Argil/Reflection/PropertyTest.php');
- $this->addTestFile('Argil/RouteTest.php');
- $this->addTestFile('Argil/Specification/LengthTest.php');
- }
+ public function __construct()
+ {
+ $this->addTestFile('Argil/Model/ContainerTest.php');
+ $this->addTestFile('Argil/Reflection/ObjectTest.php');
+ $this->addTestFile('Argil/Reflection/PropertyListTest.php');
+ $this->addTestFile('Argil/Reflection/PropertyTest.php');
+ $this->addTestFile('Argil/RouteTest.php');
+ $this->addTestFile('Argil/Specification/LengthTest.php');
+ }
}
Modified: branches/experimental/tests/Argil/Model/ContainerTest.php
===================================================================
--- branches/experimental/tests/Argil/Model/ContainerTest.php 2007-04-05 03:27:38 UTC (rev 518)
+++ branches/experimental/tests/Argil/Model/ContainerTest.php 2007-05-13 05:52:03 UTC (rev 519)
@@ -1,94 +1,76 @@
<?php
-
require_once dirname(__FILE__) . '/../../config.php';
require_once 'Argil/Model/Container.php';
-
-class ArgilSampleModel {
- /**
- * @is length 5 >
- */
- public $title = '';
-
- /**
- * @is length 10
- */
- public $lengthOfTen = '';
+class ArgilSampleModel
+{
+ /**
+ * @is length 5 >
+ */
+ public $title = '';
+ /**
+ * @is length 10
+ */
+ public $lengthOfTen = '';
}
-class ArgilSampleModelTwo { }
-
+class ArgilSampleModelTwo
+{
+}
class Argil_Model_ContainerTest extends UnitTestCase
{
- public function testWillTellWhatTypeOfObjectThisContains() {
- $container = new Argil_Model_Container(
- new ArgilSampleModel()
- );
-
- $this->assertTrue($container->is('ArgilSampleModel'));
- $this->assertFalse($container->is(__CLASS__));
- }
-
- public function testCanContainMultipleObjects() {
- $container = new Argil_Model_Container(
- new ArgilSampleModel(),
- new ArgilSampleModelTwo()
- );
-
- $this->assertFalse($container->is(__CLASS__));
- $this->assertTrue($container->is('ArgilSampleModel'));
- $this->assertTrue($container->is('ArgilSampleModelTwo'));
- }
-
- public function testWillOnlyAllowSettingOfKnownProperties() {
- $container = new Argil_Model_Container(
- new ArgilSampleModel()
- );
-
- $container->title = 'Hello World';
- $this->assertEqual($container->title, 'Hello World');
-
- try {
- $container->unknown = 'Throw Exception';
- $this->fail('Exception not caught');
- } catch (Exception $e) {
-
- }
- }
-
- public function testProperlyValidatesUsingAnnotation() {
- $container = new Argil_Model_Container(
- new ArgilSampleModel()
- );
-
- try {
- $container->lengthOfTen = '1234567890';
- $this->pass('Exception not expected');
- } catch(Exception $e) {
- $this->fail('Unexpected exception?');
- }
-
- try {
- $container->lengthOfTen = '123456789';
- $this->fail('Exception not caught');
- } catch(Exception $e) {
- $this->pass('Exception caught');
- }
- }
-
- public function testOriginalValueKeptWhenInvalidPropertySet() {
- $container = new Argil_Model_Container(
- new ArgilSampleModel()
- );
-
- $container->lengthOfTen = '1234567890';
-
- try {
- $container->lengthOfTen = '123456789';
- $this->fail('Exception not caught');
- } catch(Exception $e) {
- $this->pass('Exception caught');
- }
-
- $this->assertEqual($container->lengthOfTen, '1234567890');
- }
+ public function testWillTellWhatTypeOfObjectThisContains()
+ {
+ $container = new Argil_Model_Container(new ArgilSampleModel());
+ $this->assertTrue($container->is('ArgilSampleModel'));
+ $this->assertFalse($container->is(__CLASS__));
+ }
+ public function testCanContainMultipleObjects()
+ {
+ $container = new Argil_Model_Container(new ArgilSampleModel() , new ArgilSampleModelTwo());
+ $this->assertFalse($container->is(__CLASS__));
+ $this->assertTrue($container->is('ArgilSampleModel'));
+ $this->assertTrue($container->is('ArgilSampleModelTwo'));
+ }
+ public function testWillOnlyAllowSettingOfKnownProperties()
+ {
+ $container = new Argil_Model_Container(new ArgilSampleModel());
+ $container->title = 'Hello World';
+ $this->assertEqual($container->title, 'Hello World');
+ try {
+ $container->unknown = 'Throw Exception';
+ $this->fail('Exception not caught');
+ }
+ catch(Exception $e) {
+ }
+ }
+ public function testProperlyValidatesUsingAnnotation()
+ {
+ $container = new Argil_Model_Container(new ArgilSampleModel());
+ try {
+ $container->lengthOfTen = '1234567890';
+ $this->pass('Exception not expected');
+ }
+ catch(Exception $e) {
+ $this->fail('Unexpected exception?');
+ }
+ try {
+ $container->lengthOfTen = '123456789';
+ $this->fail('Exception not caught');
+ }
+ catch(Exception $e) {
+ $this->pass('Exception caught');
+ }
+ }
+ public function testOriginalValueKeptWhenInvalidPropertySet()
+ {
+ $container = new Argil_Model_Container(new ArgilSampleModel());
+ $container->lengthOfTen = '1234567890';
+ try {
+ $container->lengthOfTen = '123456789';
+ $this->fail('Exception not caught');
+ }
+ catch(Exception $e) {
+ $this->pass('Exception caught');
+ }
+ $this->assertEqual($container->lengthOfTen, '1234567890');
+ }
}
-
Modified: branches/experimental/tests/Argil/Reflection/ObjectTest.php
===================================================================
--- branches/experimental/tests/Argil/Reflection/ObjectTest.php 2007-04-05 03:27:38 UTC (rev 518)
+++ branches/experimental/tests/Argil/Reflection/ObjectTest.php 2007-05-13 05:52:03 UTC (rev 519)
@@ -1,34 +1,26 @@
<?php
-
require_once dirname(__FILE__) . '/../../config.php';
require_once 'Argil/Reflection/Object.php';
-
-class ArgilSampleReflectionObject {
- public $publicProperty = '';
- protected $protectedProperty = '';
- private $privateProperty = '';
+class ArgilSampleReflectionObject
+{
+ public $publicProperty = '';
+ protected $protectedProperty = '';
+ private $privateProperty = '';
}
-
class Argil_Reflection_ObjectTest extends UnitTestCase
{
- public function testReturnsArrayOfProperties() {
- $reflection = new Argil_Reflection_Object(
- new ArgilSampleReflectionObject()
- );
- $properties = $reflection->getProperties();
-
- $this->assertTrue(is_array($properties) || $properties instanceof ArrayAccess);
- $this->assertTrue(count($properties) == 3);
-
- $this->assertIsA($properties[0], 'Argil_Reflection_Property');
- }
-
- public function testReturnsANamedProperty() {
- $reflection = new Argil_Reflection_Object(
- new ArgilSampleReflectionObject()
- );
-
- $property = $reflection->getProperty('publicProperty');
- $this->assertIsA($property, 'Argil_Reflection_Property');
- }
-}
\ No newline at end of file
+ public function testReturnsArrayOfProperties()
+ {
+ $reflection = new Argil_Reflection_Object(new ArgilSampleReflectionObject());
+ $properties = $reflection->getProperties();
+ $this->assertTrue(is_array($properties) || $properties instanceof ArrayAccess);
+ $this->assertTrue(count($properties) == 3);
+ $this->assertIsA($properties[0], 'Argil_Reflection_Property');
+ }
+ public function testReturnsANamedProperty()
+ {
+ $reflection = new Argil_Reflection_Object(new ArgilSampleReflectionObject());
+ $property = $reflection->getProperty('publicProperty');
+ $this->assertIsA($property, 'Argil_Reflection_Property');
+ }
+}
Modified: branches/experimental/tests/Argil/Reflection/PropertyListTest.php
===================================================================
--- branches/experimental/tests/Argil/Reflection/PropertyListTest.php 2007-04-05 03:27:38 UTC (rev 518)
+++ branches/experimental/tests/Argil/Reflection/PropertyListTest.php 2007-05-13 05:52:03 UTC (rev 519)
@@ -1,83 +1,63 @@
<?php
-
require_once dirname(__FILE__) . '/../../config.php';
require_once 'Argil/Reflection/PropertyList.php';
-
-class ArgilSampleReflectionObjectForProperties {
- public $publicProperty = '';
- protected $protectedProperty = '';
- private $privateProperty = '';
+class ArgilSampleReflectionObjectForProperties
+{
+ public $publicProperty = '';
+ protected $protectedProperty = '';
+ private $privateProperty = '';
}
-
-class Argil_Reflection_PropertyListTest extends UnitTestCase {
- public function testActsAsArray() {
- $reflection = new ReflectionObject(
- new ArgilSampleReflectionObjectForProperties()
- );
-
- $properties = new Argil_Reflection_PropertyList(
- $reflection->getProperties()
- );
-
- $this->assertIsA($properties, 'Countable');
- $this->assertIsA($properties, 'ArrayAccess');
- $this->assertIsA($properties, 'SeekableIterator');
-
- // sanity check for Countable
- $this->assertEqual(3, count($properties));
-
- // sanity check for ArrayAccess
- $this->assertTrue(isset($properties[0]));
- $this->assertNotNull($properties[0]);
- }
-
- public function testArrayIsReadOnly() {
- $reflection = new ReflectionObject(
- new ArgilSampleReflectionObjectForProperties()
- );
-
- $properties = new Argil_Reflection_PropertyList(
- $reflection->getProperties()
- );
-
- try {
- $properties['unknown'] = "Shouldn't work";
- $this->fail('Exception not caught');
- } catch (Exception $e) {
- $this->pass('Exception caught');
- }
-
- try {
- $this->assertTrue(isset($properties[0]));
- $properties[0] = "Shouldn't work";
- $this->fail('Exception not caught');
- } catch (Exception $e) {
- $this->pass('Exception caught');
- }
-
- try {
- $this->assertTrue(isset($properties[0]));
- unset($properties[0]);
- $this->fail('Exception not caught');
- } catch (Exception $e) {
- $this->pass('Exception caught');
- $this->assertTrue(isset($properties[0]));
- }
- }
-
- public function testMapsAllValuesToArgilWrapper() {
- $reflection = new ReflectionObject(
- new ArgilSampleReflectionObjectForProperties()
- );
-
- $properties = new Argil_Reflection_PropertyList(
- $reflection->getProperties()
- );
-
- // sanity check
- $this->assertTrue(isset($properties[0]));
- $this->assertIsA($properties[0], 'Argil_Reflection_Property');
-
- $this->assertEqual('publicProperty', $properties[0]->getName());
- }
-}
\ No newline at end of file
+class Argil_Reflection_PropertyListTest extends UnitTestCase
+{
+ public function testActsAsArray()
+ {
+ $reflection = new ReflectionObject(new ArgilSampleReflectionObjectForProperties());
+ $properties = new Argil_Reflection_PropertyList($reflection->getProperties());
+ $this->assertIsA($properties, 'Countable');
+ $this->assertIsA($properties, 'ArrayAccess');
+ $this->assertIsA($properties, 'SeekableIterator');
+ // sanity check for Countable
+ $this->assertEqual(3, count($properties));
+ // sanity check for ArrayAccess
+ $this->assertTrue(isset($properties[0]));
+ $this->assertNotNull($properties[0]);
+ }
+ public function testArrayIsReadOnly()
+ {
+ $reflection = new ReflectionObject(new ArgilSampleReflectionObjectForProperties());
+ $properties = new Argil_Reflection_PropertyList($reflection->getProperties());
+ try {
+ $properties['unknown'] = "Shouldn't work";
+ $this->fail('Exception not caught');
+ }
+ catch(Exception $e) {
+ $this->pass('Exception caught');
+ }
+ try {
+ $this->assertTrue(isset($properties[0]));
+ $properties[0] = "Shouldn't work";
+ $this->fail('Exception not caught');
+ }
+ catch(Exception $e) {
+ $this->pass('Exception caught');
+ }
+ try {
+ $this->assertTrue(isset($properties[0]));
+ unset($properties[0]);
+ $this->fail('Exception not caught');
+ }
+ catch(Exception $e) {
+ $this->pass('Exception caught');
+ $this->assertTrue(isset($properties[0]));
+ }
+ }
+ public function testMapsAllValuesToArgilWrapper()
+ {
+ $reflection = new ReflectionObject(new ArgilSampleReflectionObjectForProperties());
+ $properties = new Argil_Reflection_PropertyList($reflection->getProperties());
+ // sanity check
+ $this->assertTrue(isset($properties[0]));
+ $this->assertIsA($properties[0], 'Argil_Reflection_Property');
+ $this->assertEqual('publicProperty', $properties[0]->getName());
+ }
+}
Modified: branches/experimental/tests/Argil/Reflection/PropertyTest.php
===================================================================
--- branches/experimental/tests/Argil/Reflection/PropertyTest.php 2007-04-05 03:27:38 UTC (rev 518)
+++ branches/experimental/tests/Argil/Reflection/PropertyTest.php 2007-05-13 05:52:03 UTC (rev 519)
@@ -1,72 +1,56 @@
<?php
-
require_once dirname(__FILE__) . '/../../config.php';
require_once 'Argil/Reflection/Property.php';
-
-class ArgilSamplePropertyObjectForReflection {
- /**
- * @is length 10 <=
- * @is length 5 >=
- */
- public $publicProperty;
- protected $protectedProperty;
- private $privateProperty;
-
- /**
- * @isNot length 5 <
- */
- public $notLessThanFive;
+class ArgilSamplePropertyObjectForReflection
+{
+ /**
+ * @is length 10 <=
+ * @is length 5 >=
+ */
+ public $publicProperty;
+ protected $protectedProperty;
+ private $privateProperty;
+ /**
+ * @isNot length 5 <
+ */
+ public $notLessThanFive;
}
-
-class Argil_Reflection_PropertyTest extends UnitTestCase {
- public function testWrapsReflectionPropertyObject() {
- $reflection = new ReflectionObject(
- new ArgilSamplePropertyObjectForReflection()
- );
-
- $properties = $reflection->getProperties();
-
- $public = new Argil_Reflection_Property($properties[0]);
- $this->assertTrue($public->isPublic());
- $this->assertFalse($public->isProtected());
- $this->assertFalse($public->isPrivate());
- $this->assertEqual($public->getName(), 'publicProperty');
-
- $protected = new Argil_Reflection_Property($properties[1]);
- $this->assertTrue($protected->isProtected());
- $this->assertFalse($protected->isPublic());
- $this->assertFalse($protected->isPrivate());
-
- $private = new Argil_Reflection_Property($properties[2]);
- $this->assertTrue($private->isPrivate());
- $this->assertFalse($private->isPublic());
- $this->assertFalse($private->isProtected());
- }
-
- public function testUsesDocBlockToDetermineValidity() {
- $reflection = new ReflectionObject(
- new ArgilSamplePropertyObjectForReflection()
- );
-
- $properties = $reflection->getProperties();
-
- $public = new Argil_Reflection_Property($properties[0]);
-
- $object = new ArgilSamplePropertyObjectForReflection();
- $object->publicProperty = '1234567890';
- $this->assertTrue($public->isValid($object));
-
- $object->publicProperty = '12345678901';
- $this->assertFalse($public->isValid($object));
-
- $object->publicProperty = '1234';
- $this->assertFalse($public->isValid($object));
-
- $object->notLessThanFive = '1234';
- $attribute = new Argil_Reflection_Property($properties[3]);
- $this->assertFalse($attribute->isValid($object));
-
- $object->notLessThanFive = '12345';
- $this->assertTrue($attribute->isValid($object));
- }
-}
\ No newline at end of file
+class Argil_Reflection_PropertyTest extends UnitTestCase
+{
+ public function testWrapsReflectionPropertyObject()
+ {
+ $reflection = new ReflectionObject(new ArgilSamplePropertyObjectForReflection());
+ $properties = $reflection->getProperties();
+ $public = new Argil_Reflection_Property($properties[0]);
+ $this->assertTrue($public->isPublic());
+ $this->assertFalse($public->isProtected());
+ $this->assertFalse($public->isPrivate());
+ $this->assertEqual($public->getName() , 'publicProperty');
+ $protected = new Argil_Reflection_Property($properties[1]);
+ $this->assertTrue($protected->isProtected());
+ $this->assertFalse($protected->isPublic());
+ $this->assertFalse($protected->isPrivate());
+ $private = new Argil_Reflection_Property($properties[2]);
+ $this->assertTrue($private->isPrivate());
+ $this->assertFalse($private->isPublic());
+ $this->assertFalse($private->isProtected());
+ }
+ public function testUsesDocBlockToDetermineValidity()
+ {
+ $reflection = new ReflectionObject(new ArgilSamplePropertyObjectForReflection());
+ $properties = $reflection->getProperties();
+ $public = new Argil_Reflection_Property($properties[0]);
+ $object = new ArgilSamplePropertyObjectForReflection();
+ $object->publicProperty = '1234567890';
+ $this->assertTrue($public->isValid($object));
+ $object->publicProperty = '12345678901';
+ $this->assertFalse($public->isValid($object));
+ $object->publicProperty = '1234';
+ $this->assertFalse($public->isValid($object));
+ $object->notLessThanFive = '1234';
+ $attribute = new Argil_Reflection_Property($properties[3]);
+ $this->assertFalse($attribute->isValid($object));
+ $object->notLessThanFive = '12345';
+ $this->assertTrue($attribute->isValid($object));
+ }
+}
Modified: branches/experimental/tests/Argil/RouteTest.php
===================================================================
--- branches/experimental/tests/Argil/RouteTest.php 2007-04-05 03:27:38 UTC (rev 518)
+++ branches/experimental/tests/Argil/RouteTest.php 2007-05-13 05:52:03 UTC (rev 519)
@@ -1,29 +1,23 @@
<?php
-
require_once dirname(__FILE__) . '/../config.php';
require_once 'Argil/Route.php';
-
-class ArgilCallbackObject {
- public function callback() { }
+class ArgilCallbackObject
+{
+ public function callback()
+ {
+ }
}
-
Mock::generate('ArgilCallbackObject');
-
class Argil_RouteTest extends UnitTestCase
{
- public function testBasicCallback() {
- $mock = new MockArgilCallbackObject();
- $mock->expectOnce('callback');
-
- $route = new Argil_Route(
- array(
- $mock,
- 'callback'
- )
- );
-
- $route->execute();
- }
+ public function testBasicCallback()
+ {
+ $mock = new MockArgilCallbackObject();
+ $mock->expectOnce('callback');
+ $route = new Argil_Route(array(
+ $mock,
+ 'callback'
+ ));
+ $route->execute();
+ }
}
-
-
Modified: branches/experimental/tests/Argil/Specification/LengthTest.php
===================================================================
--- branches/experimental/tests/Argil/Specification/LengthTest.php 2007-04-05 03:27:38 UTC (rev 518)
+++ branches/experimental/tests/Argil/Specification/LengthTest.php 2007-05-13 05:52:03 UTC (rev 519)
@@ -1,77 +1,67 @@
<?php
-
require_once dirname(__FILE__) . '/../../config.php';
require_once 'Argil/Specification/Length.php';
-
class Argil_Specification_LengthTest extends UnitTestCase
{
- public function testAllowsLengthEquals() {
- $spec = new Argil_Specification_Length('12345', 5);
- $this->assertTrue($spec->valid());
-
- $spec = new Argil_Specification_Length('123456', 5);
- $this->assertFalse($spec->valid());
- }
-
- public function testAllowsLengthLesserThanOrEquals() {
- $spec = new Argil_Specification_Length('12345', 5, '<=');
- $this->assertTrue($spec->valid());
-
- $spec = new Argil_Specification_Length('1234', 5, '<=');
- $this->assertTrue($spec->valid());
-
- $spec = new Argil_Specification_Length('123456', 5, '<=');
- $this->assertFalse($spec->valid());
- }
-
- public function testAllowsLengthGreaterThanOrEquals() {
- $spec = new Argil_Specification_Length('12345', 4, '>=');
- $this->assertTrue($spec->valid());
-
- $spec = new Argil_Specification_Length('1234', 4, '>=');
- $this->assertTrue($spec->valid());
-
- $spec = new Argil_Specification_Length('123', 4, '>=');
- $this->assertFalse($spec->valid());
- }
-
- public function testAllowsLengthGreaterThan() {
- $spec = new Argil_Specification_Length('12345', 4, '>');
- $this->assertTrue($spec->valid());
-
- $spec = new Argil_Specification_Length('1234', 4, '>');
- $this->assertFalse($spec->valid());
- }
-
- public function testAllowsLengthLesserThan() {
- $spec = new Argil_Specification_Length('12345', 6, '<');
- $this->assertTrue($spec->valid());
-
- $spec = new Argil_Specification_Length('123456', 6, '<');
- $this->assertFalse($spec->valid());
- }
-
- public function testAllowsBothNotEquals() {
- $spec = new Argil_Specification_Length('123456', 5, '<>');
- $this->assertTrue($spec->valid());
-
- $spec = new Argil_Specification_Length('123456', 5, '!=');
- $this->assertTrue($spec->valid());
-
- $spec = new Argil_Specification_Length('12345', 5, '<>');
- $this->assertFalse($spec->valid());
-
- $spec = new Argil_Specification_Length('12345', 5, '!=');
- $this->assertFalse($spec->valid());
- }
-
- public function testThrowsExceptionOnUnknownComparisonType() {
- $spec = new Argil_Specification_Length('12345', 5, 'unknown');
- try {
- $spec->valid();
- $this->fail('Exception not caught');
- } catch (Exception $e) {
- $this->pass('Exception caught');
- }
- }
-}
\ No newline at end of file
+ public function testAllowsLengthEquals()
+ {
+ $spec = new Argil_Specification_Length('12345', 5);
+ $this->assertTrue($spec->valid());
+ $spec = new Argil_Specification_Length('123456', 5);
+ $this->assertFalse($spec->valid());
+ }
+ public function testAllowsLengthLesserThanOrEquals()
+ {
+ $spec = new Argil_Specification_Length('12345', 5, '<=');
+ $this->assertTrue($spec->valid());
+ $spec = new Argil_Specification_Length('1234', 5, '<=');
+ $this->assertTrue($spec->valid());
+ $spec = new Argil_Specification_Length('123456', 5, '<=');
+ $this->assertFalse($spec->valid());
+ }
+ public function testAllowsLengthGreaterThanOrEquals()
+ {
+ $spec = new Argil_Specification_Length('12345', 4, '>=');
+ $this->assertTrue($spec->valid());
+ $spec = new Argil_Specification_Length('1234', 4, '>=');
+ $this->assertTrue($spec->valid());
+ $spec = new Argil_Specification_Length('123', 4, '>=');
+ $this->assertFalse($spec->valid());
+ }
+ public function testAllowsLengthGreaterThan()
+ {
+ $spec = new Argil_Specification_Length('12345', 4, '>');
+ $this->assertTrue($spec->valid());
+ $spec = new Argil_Specification_Length('1234', 4, '>');
+ $this->assertFalse($spec->valid());
+ }
+ public function testAllowsLengthLesserThan()
+ {
+ $spec = new Argil_Specification_Length('12345', 6, '<');
+ $this->assertTrue($spec->valid());
+ $spec = new Argil_Specification_Length('123456', 6, '<');
+ $this->assertFalse($spec->valid());
+ }
+ public function testAllowsBothNotEquals()
+ {
+ $spec = new Argil_Specification_Length('123456', 5, '<>');
+ $this->assertTrue($spec->valid());
+ $spec = new Argil_Specification_Length('123456', 5, '!=');
+ $this->assertTrue($spec->valid());
+ $spec = new Argil_Specification_Length('12345', 5, '<>');
+ $this->assertFalse($spec->valid());
+ $spec = new Argil_Specification_Length('12345', 5, '!=');
+ $this->assertFalse($spec->valid());
+ }
+ public function testThrowsExceptionOnUnknownComparisonType()
+ {
+ $spec = new Argil_Specification_Length('12345', 5, 'unknown');
+ try {
+ $spec->valid();
+ $this->fail('Exception not caught');
+ }
+ catch(Exception $e) {
+ $this->pass('Exception caught');
+ }
+ }
+}
Modified: branches/experimental/tests/config.php
===================================================================
--- branches/experimental/tests/config.php 2007-04-05 03:27:38 UTC (rev 518)
+++ branches/experimental/tests/config.php 2007-05-13 05:52:03 UTC (rev 519)
@@ -1,11 +1,5 @@
<?php
-
require_once 'simpletest/unit_tester.php';
require_once 'simpletest/mock_objects.php';
require_once 'simpletest/autorun.php';
-
-set_include_path(
- dirname(__FILE__) . PATH_SEPARATOR .
- dirname(__FILE__) . '/../src' . PATH_SEPARATOR .
- get_include_path()
-);
+set_include_path(dirname(__FILE__) . PATH_SEPARATOR . dirname(__FILE__) . '/../src' . PATH_SEPARATOR . get_include_path());
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|