From 58e23aa03c4afad42a08b0edda16992ed00270d9 Mon Sep 17 00:00:00 2001 From: Jasper Horn Date: Wed, 14 Aug 2013 18:02:41 +0200 Subject: [PATCH] Improved naming for Conditions The naming for conditions is now (somewhat) more consistent. --- .../Condition/{Greater.php => EqualTo.php} | 4 +- Good/Manners/Condition/GreaterOrEqual.php | 24 ++++ Good/Manners/Condition/GreaterOrEquals.php | 24 ---- .../{Inequality.php => GreaterThan.php} | 4 +- Good/Manners/Condition/LessOrEqual.php | 24 ++++ Good/Manners/Condition/LessOrEquals.php | 24 ---- .../Condition/{Equality.php => LessThan.php} | 4 +- .../Condition/{Less.php => NotEqualTo.php} | 4 +- Good/Manners/ConditionProcessor.php | 12 +- Good/Memory/SQL/ConditionWriter.php | 24 ++-- Good/Memory/SQL/UpdateConditionWriter.php | 12 +- .../Manners/GoodMannersAdvancedUpdateTest.php | 106 +++++++-------- tests/Manners/GoodMannersDeleteTest.php | 4 +- tests/Manners/GoodMannersGetTest.php | 122 +++++++++--------- tests/Manners/GoodMannersInsertTest.php | 2 +- tests/Manners/GoodMannersPersistenceTest.php | 2 +- tests/Manners/GoodMannersSimpleUpdateTest.php | 8 +- 17 files changed, 202 insertions(+), 202 deletions(-) rename Good/Manners/Condition/{Greater.php => EqualTo.php} (77%) create mode 100644 Good/Manners/Condition/GreaterOrEqual.php delete mode 100644 Good/Manners/Condition/GreaterOrEquals.php rename Good/Manners/Condition/{Inequality.php => GreaterThan.php} (76%) create mode 100644 Good/Manners/Condition/LessOrEqual.php delete mode 100644 Good/Manners/Condition/LessOrEquals.php rename Good/Manners/Condition/{Equality.php => LessThan.php} (77%) rename Good/Manners/Condition/{Less.php => NotEqualTo.php} (76%) diff --git a/Good/Manners/Condition/Greater.php b/Good/Manners/Condition/EqualTo.php similarity index 77% rename from Good/Manners/Condition/Greater.php rename to Good/Manners/Condition/EqualTo.php index b4bb50a..f6e2b0c 100644 --- a/Good/Manners/Condition/Greater.php +++ b/Good/Manners/Condition/EqualTo.php @@ -6,7 +6,7 @@ use Good\Manners\ConditionProcessor; use Good\Manners\Storable; -class Greater implements Condition +class EqualTo implements Condition { private $to; @@ -17,7 +17,7 @@ public function __construct(Storable $to) public function process(ConditionProcessor $processor) { - $processor->processGreaterCondition($this->to); + $processor->processEqualToCondition($this->to); } } diff --git a/Good/Manners/Condition/GreaterOrEqual.php b/Good/Manners/Condition/GreaterOrEqual.php new file mode 100644 index 0000000..fa9ba88 --- /dev/null +++ b/Good/Manners/Condition/GreaterOrEqual.php @@ -0,0 +1,24 @@ +to = $to; + } + + public function process(ConditionProcessor $processor) + { + $processor->processGreaterOrEqualCondition($this->to); + } +} + +?> \ No newline at end of file diff --git a/Good/Manners/Condition/GreaterOrEquals.php b/Good/Manners/Condition/GreaterOrEquals.php deleted file mode 100644 index f0001a4..0000000 --- a/Good/Manners/Condition/GreaterOrEquals.php +++ /dev/null @@ -1,24 +0,0 @@ -to = $to; - } - - public function process(ConditionProcessor $processor) - { - $processor->processGreaterOrEqualsCondition($this->to); - } -} - -?> \ No newline at end of file diff --git a/Good/Manners/Condition/Inequality.php b/Good/Manners/Condition/GreaterThan.php similarity index 76% rename from Good/Manners/Condition/Inequality.php rename to Good/Manners/Condition/GreaterThan.php index 2412b95..eb1a364 100644 --- a/Good/Manners/Condition/Inequality.php +++ b/Good/Manners/Condition/GreaterThan.php @@ -6,7 +6,7 @@ use Good\Manners\ConditionProcessor; use Good\Manners\Storable; -class Inequality implements Condition +class GreaterThan implements Condition { private $to; @@ -17,7 +17,7 @@ public function __construct(Storable $to) public function process(ConditionProcessor $processor) { - $processor->processInequalityCondition($this->to); + $processor->processGreaterThanCondition($this->to); } } diff --git a/Good/Manners/Condition/LessOrEqual.php b/Good/Manners/Condition/LessOrEqual.php new file mode 100644 index 0000000..47c7843 --- /dev/null +++ b/Good/Manners/Condition/LessOrEqual.php @@ -0,0 +1,24 @@ +to = $to; + } + + public function process(ConditionProcessor $processor) + { + $processor->processLessOrEqualCondition($this->to); + } +} + +?> \ No newline at end of file diff --git a/Good/Manners/Condition/LessOrEquals.php b/Good/Manners/Condition/LessOrEquals.php deleted file mode 100644 index 872e006..0000000 --- a/Good/Manners/Condition/LessOrEquals.php +++ /dev/null @@ -1,24 +0,0 @@ -to = $to; - } - - public function process(ConditionProcessor $processor) - { - $processor->processLessOrEqualsCondition($this->to); - } -} - -?> \ No newline at end of file diff --git a/Good/Manners/Condition/Equality.php b/Good/Manners/Condition/LessThan.php similarity index 77% rename from Good/Manners/Condition/Equality.php rename to Good/Manners/Condition/LessThan.php index f2cdbaf..19e9e5d 100644 --- a/Good/Manners/Condition/Equality.php +++ b/Good/Manners/Condition/LessThan.php @@ -6,7 +6,7 @@ use Good\Manners\ConditionProcessor; use Good\Manners\Storable; -class Equality implements Condition +class LessThan implements Condition { private $to; @@ -17,7 +17,7 @@ public function __construct(Storable $to) public function process(ConditionProcessor $processor) { - $processor->processEqualityCondition($this->to); + $processor->processLessThanCondition($this->to); } } diff --git a/Good/Manners/Condition/Less.php b/Good/Manners/Condition/NotEqualTo.php similarity index 76% rename from Good/Manners/Condition/Less.php rename to Good/Manners/Condition/NotEqualTo.php index 798e3a1..e8af1d6 100644 --- a/Good/Manners/Condition/Less.php +++ b/Good/Manners/Condition/NotEqualTo.php @@ -6,7 +6,7 @@ use Good\Manners\ConditionProcessor; use Good\Manners\Storable; -class Less implements Condition +class NotEqualTo implements Condition { private $to; @@ -17,7 +17,7 @@ public function __construct(Storable $to) public function process(ConditionProcessor $processor) { - $processor->processLessCondition($this->to); + $processor->processNotEqualToCondition($this->to); } } diff --git a/Good/Manners/ConditionProcessor.php b/Good/Manners/ConditionProcessor.php index 47304f6..152d0fb 100644 --- a/Good/Manners/ConditionProcessor.php +++ b/Good/Manners/ConditionProcessor.php @@ -4,12 +4,12 @@ interface ConditionProcessor { - public function processEqualityCondition(Storable $to); - public function processInequalityCondition(Storable $to); - public function processGreaterCondition(Storable $to); - public function processGreaterOrEqualsCondition(Storable $to); - public function processLessCondition(Storable $to); - public function processLessOrEqualsCondition(Storable $to); + public function processEqualToCondition(Storable $to); + public function processNotEqualToCondition(Storable $to); + public function processGreaterThanCondition(Storable $to); + public function processGreaterOrEqualCondition(Storable $to); + public function processLessThanCondition(Storable $to); + public function processLessOrEqualCondition(Storable $to); public function processAndCondition(Condition $condition1, Condition $condition2); public function processOrCondition(Condition $condition1, Condition $condition2); diff --git a/Good/Memory/SQL/ConditionWriter.php b/Good/Memory/SQL/ConditionWriter.php index d4e13da..ca5f683 100644 --- a/Good/Memory/SQL/ConditionWriter.php +++ b/Good/Memory/SQL/ConditionWriter.php @@ -56,27 +56,27 @@ public function writeComparisonCondition(Storable $to, $comparison) } } - public function processEqualityCondition(Storable $to) + public function processEqualToCondition(Storable $to) { $this->writeComparisonCondition($to, '='); } - public function processInequalityCondition(Storable $to) + public function processNotEqualToCondition(Storable $to) { $this->writeComparisonCondition($to, '<>'); } - public function processGreaterCondition(Storable $to) + public function processGreaterThanCondition(Storable $to) { $this->writeComparisonCondition($to, '>'); } - public function processGreaterOrEqualsCondition(Storable $to) + public function processGreaterOrEqualCondition(Storable $to) { $this->writeComparisonCondition($to, '>='); } - public function processLessCondition(Storable $to) + public function processLessThanCondition(Storable $to) { $this->writeComparisonCondition($to, '<'); } - public function processLessOrEqualsCondition(Storable $to) + public function processLessOrEqualCondition(Storable $to) { $this->writeComparisonCondition($to, '<='); } @@ -122,14 +122,14 @@ public function visitReferenceProperty($name, $datatypeName, $dirty, ' IS NOT NULL'; } - // todo: error out if not equality or inequality + // todo: error out if not EqualTo or NotEqualTo } else if (!$value->isNew()) { $this->condition .= 't' . $this->currentTable . '.' . $this->storage->fieldNamify($name) . $this->comparison . ' ' . \intval($value->getId()); - // todo: error out if not equality or inequality + // todo: error out if not EqualTo or NotEqualTo } else { @@ -166,7 +166,7 @@ public function visitTextProperty($name, $dirty, $value) $this->condition .= ' IS NOT NULL'; } - // todo: error out if not equality or inequality + // todo: error out if not EqualTo or NotEqualTo } else { @@ -193,7 +193,7 @@ public function visitIntProperty($name, $dirty, $value) $this->condition .= ' IS NOT NULL'; } - // todo: error out if not equality or inequality + // todo: error out if not EqualTo or NotEqualTo } else { @@ -219,7 +219,7 @@ public function visitFloatProperty($name, $dirty, $value) $this->condition .= ' IS NOT NULL'; } - // todo: error out if not equality or inequality + // todo: error out if not EqualTo or NotEqualTo } else { @@ -245,7 +245,7 @@ public function visitDatetimeProperty($name, $dirty, $value) $this->condition .= ' IS NOT NULL'; } - // todo: error out if not equality or inequality + // todo: error out if not equality or NotEqualTo } else { diff --git a/Good/Memory/SQL/UpdateConditionWriter.php b/Good/Memory/SQL/UpdateConditionWriter.php index 257143b..a3ab9d0 100644 --- a/Good/Memory/SQL/UpdateConditionWriter.php +++ b/Good/Memory/SQL/UpdateConditionWriter.php @@ -150,27 +150,27 @@ public function writeSimpleComparisonCondition(Storable $to, $comparison) } - public function processEqualityCondition(Storable $to) + public function processEqualToCondition(Storable $to) { $this->writeComparisonCondition($to, '='); } - public function processInequalityCondition(Storable $to) + public function processNotEqualToCondition(Storable $to) { $this->writeComparisonCondition($to, '<>'); } - public function processGreaterCondition(Storable $to) + public function processGreaterThanCondition(Storable $to) { $this->writeComparisonCondition($to, '>'); } - public function processGreaterOrEqualsCondition(Storable $to) + public function processGreaterOrEqualCondition(Storable $to) { $this->writeComparisonCondition($to, '>='); } - public function processLessCondition(Storable $to) + public function processLessThanCondition(Storable $to) { $this->writeComparisonCondition($to, '<'); } - public function processLessOrEqualsCondition(Storable $to) + public function processLessOrEqualCondition(Storable $to) { $this->writeComparisonCondition($to, '<='); } diff --git a/tests/Manners/GoodMannersAdvancedUpdateTest.php b/tests/Manners/GoodMannersAdvancedUpdateTest.php index 4b05eca..ca02d88 100644 --- a/tests/Manners/GoodMannersAdvancedUpdateTest.php +++ b/tests/Manners/GoodMannersAdvancedUpdateTest.php @@ -264,7 +264,7 @@ private function checkResults($expected) // At the moment we don't have a proper api to get any, // but this trick does do the same $type = new AdvancedUpdateType(); - $any = new \Good\Manners\Condition\Greater($type); + $any = new \Good\Manners\Condition\GreaterThan($type); $resolver = new AdvancedUpdateTypeResolver(); $resolver->resolveMyReference(); @@ -287,7 +287,7 @@ public function testAdvancedUpdate() // At the moment we don't have a proper api to get any, // but this trick does do the same $type = new AdvancedUpdateType(); - $any = new \Good\Manners\Condition\Greater($type); + $any = new \Good\Manners\Condition\GreaterThan($type); $modifications = new AdvancedUpdateType(); $modifications->setMyInt(55); @@ -361,11 +361,11 @@ public function testAdavancedUpdateSetToNull() // but this trick does do the same $type = new AdvancedUpdateType(); $type->setMyInt(5); - $greater = new \Good\Manners\Condition\Greater($type); + $greater = new \Good\Manners\Condition\GreaterThan($type); $type = new AdvancedUpdateType(); $type->setMyFloat(20.0); - $less = new \Good\Manners\Condition\Less($type); + $less = new \Good\Manners\Condition\LessThan($type); $and = new \Good\Manners\Condition\AndCondition($greater, $less); @@ -439,7 +439,7 @@ public function testAdvancedUpdateSetReferenceToNull() { $type = new AdvancedUpdateType(); $type->setMyInt(8); - $any = new \Good\Manners\Condition\Equality($type); + $any = new \Good\Manners\Condition\EqualTo($type); $modifications = new AdvancedUpdateType(); $modifications->setMyReference(null); @@ -507,7 +507,7 @@ public function testAdvancedUpdateSetReferenceToExistingObject() // first, we're fetching the object $type = new AdvancedUpdateType(); $type->setMyInt(10); - $any = new \Good\Manners\Condition\Equality($type); + $any = new \Good\Manners\Condition\EqualTo($type); $resolver = new AdvancedUpdateTypeResolver(); $resolver->resolveMyReference(); @@ -518,7 +518,7 @@ public function testAdvancedUpdateSetReferenceToExistingObject() $type = new AdvancedUpdateType(); $type->setMyInt(8); - $any = new \Good\Manners\Condition\Less($type); + $any = new \Good\Manners\Condition\LessThan($type); $modifications = new AdvancedUpdateType(); $modifications->setMyReference($ref); @@ -588,7 +588,7 @@ public function testAdvancedUpdateSetReferenceToExistingObject() $type = new YetAnotherType(); $type->setYourInt(20); - $cond = new \Good\Manners\Condition\Equality($type); + $cond = new \Good\Manners\Condition\EqualTo($type); $collection = $this->storage2->getCollection($cond, new YetAnotherTypeResolver()); @@ -601,7 +601,7 @@ public function testAdvancedUpdateSetReferenceToNewObject() { $type = new AdvancedUpdateType(); $type->setMyInt(8); - $any = new \Good\Manners\Condition\Equality($type); + $any = new \Good\Manners\Condition\EqualTo($type); $modifications = new AdvancedUpdateType(); $ref = new YetAnotherType(); @@ -672,7 +672,7 @@ public function testAdvancedUpdateSetReferenceToNewObject() public function testAdvancedUpdateSetPropertyOfReference() { $type = new AdvancedUpdateType(); - $any = new \Good\Manners\Condition\Equality($type); + $any = new \Good\Manners\Condition\EqualTo($type); $modifications = new AdvancedUpdateType(); $ref = new YetAnotherType(); @@ -741,7 +741,7 @@ public function testAdvancedUpdateSetPropertyOfReference() // Check there are still 4 separate YetAnotherType objects $type = new YetAnotherType(); - $cond = new \Good\Manners\Condition\Equality($type); + $cond = new \Good\Manners\Condition\EqualTo($type); $collection = $this->storage2->getCollection($cond, new YetAnotherTypeResolver()); @@ -757,60 +757,60 @@ public function testAdvancedUpdateSetPropertyOfReference() public function testAdvancedUpdateComparisons() { - // Equality + // EqualTo $type = new AdvancedUpdateType(); $type->setMyInt(4); - $any = new \Good\Manners\Condition\Equality($type); + $any = new \Good\Manners\Condition\EqualTo($type); $modifications = new AdvancedUpdateType(); $modifications->setMyInt(1); $this->storage1->modifyAny($any, $modifications); - // Inequality + // NotEqualTo $type = new AdvancedUpdateType(); $type->setMyInt(1); - $any = new \Good\Manners\Condition\Inequality($type); + $any = new \Good\Manners\Condition\NotEqualTo($type); $modifications = new AdvancedUpdateType(); $modifications->setMyText("Hello World!"); $this->storage1->modifyAny($any, $modifications); - // Less + // LessThan $type = new AdvancedUpdateType(); $type->setMyInt(5); - $any = new \Good\Manners\Condition\Less($type); + $any = new \Good\Manners\Condition\LessThan($type); $modifications = new AdvancedUpdateType(); $modifications->setMyText("Goodbye"); $this->storage1->modifyAny($any, $modifications); - // LessOrEquals + // LessOrEqual $type = new AdvancedUpdateType(); $type->setMyInt(5); - $any = new \Good\Manners\Condition\LessOrEquals($type); + $any = new \Good\Manners\Condition\LessOrEqual($type); $modifications = new AdvancedUpdateType(); $modifications->setMyFloat(47.47); $this->storage1->modifyAny($any, $modifications); - // Greater + // GreaterThan $type = new AdvancedUpdateType(); $type->setMyInt(8); - $any = new \Good\Manners\Condition\Greater($type); + $any = new \Good\Manners\Condition\GreaterThan($type); $modifications = new AdvancedUpdateType(); $modifications->setMyFloat(11.11); $this->storage1->modifyAny($any, $modifications); - // GreaterOrEquals + // GreaterOrEqual $type = new AdvancedUpdateType(); $type->setMyInt(8); - $any = new \Good\Manners\Condition\GreaterOrEquals($type); + $any = new \Good\Manners\Condition\GreaterOrEqual($type); $modifications = new AdvancedUpdateType(); $modifications->setMyDatetime(new Datetime('1989-04-11')); @@ -878,11 +878,11 @@ public function testAdvancedUpdateAndOr() { $type = new AdvancedUpdateType(); $type->setMyInt(10); - $less = new \Good\Manners\Condition\Less($type); + $less = new \Good\Manners\Condition\LessThan($type); $type = new AdvancedUpdateType(); $type->setMyInt(4); - $greater = new \Good\Manners\Condition\Greater($type); + $greater = new \Good\Manners\Condition\GreaterThan($type); $any = new \Good\Manners\Condition\AndCondition($less, $greater); @@ -893,11 +893,11 @@ public function testAdvancedUpdateAndOr() $type = new AdvancedUpdateType(); $type->setMyInt(5); - $less = new \Good\Manners\Condition\Less($type); + $less = new \Good\Manners\Condition\LessThan($type); $type = new AdvancedUpdateType(); $type->setMyInt(8); - $greater = new \Good\Manners\Condition\Greater($type); + $greater = new \Good\Manners\Condition\GreaterThan($type); $any = new \Good\Manners\Condition\OrCondition($less, $greater); @@ -971,7 +971,7 @@ public function testAdvancedUpdateMultipleInOneCondition() $type->setMyReference(new YetAnotherType()); $type->getMyReference()->setYourInt(10); - $any = new \Good\Manners\Condition\Greater($type); + $any = new \Good\Manners\Condition\GreaterThan($type); $modifications = new AdvancedUpdateType(); $modifications->setMyText("Something else"); @@ -1041,7 +1041,7 @@ public function testAdvancedUpdateByDate() $type = new AdvancedUpdateType(); $type->setMyDatetime(new Datetime('2005-05-05')); - $any = new \Good\Manners\Condition\Greater($type); + $any = new \Good\Manners\Condition\GreaterThan($type); $modifications = new AdvancedUpdateType(); $modifications->setMyInt(-1); @@ -1111,7 +1111,7 @@ public function testAdvancedUpdateByText() $type = new AdvancedUpdateType(); $type->setMyText("Four"); - $any = new \Good\Manners\Condition\Equality($type); + $any = new \Good\Manners\Condition\EqualTo($type); $modifications = new AdvancedUpdateType(); $modifications->setMyInt(455); @@ -1181,7 +1181,7 @@ public function testAdvancedUpdateEqualsNull() $type = new AdvancedUpdateType(); $type->setMyInt(null); - $any = new \Good\Manners\Condition\Equality($type); + $any = new \Good\Manners\Condition\EqualTo($type); $modifications = new AdvancedUpdateType(); $modifications->setMyFloat(666.666); @@ -1191,7 +1191,7 @@ public function testAdvancedUpdateEqualsNull() $type = new AdvancedUpdateType(); $type->setMyFloat(null); - $any = new \Good\Manners\Condition\Equality($type); + $any = new \Good\Manners\Condition\EqualTo($type); $modifications = new AdvancedUpdateType(); $modifications->setMyInt(666); @@ -1201,7 +1201,7 @@ public function testAdvancedUpdateEqualsNull() $type = new AdvancedUpdateType(); $type->setMyText(null); - $any = new \Good\Manners\Condition\Equality($type); + $any = new \Good\Manners\Condition\EqualTo($type); $modifications = new AdvancedUpdateType(); $modifications->setMyDatetime(new Datetime('2066-06-06')); @@ -1211,7 +1211,7 @@ public function testAdvancedUpdateEqualsNull() $type = new AdvancedUpdateType(); $type->setMyDatetime(null); - $any = new \Good\Manners\Condition\Equality($type); + $any = new \Good\Manners\Condition\EqualTo($type); $modifications = new AdvancedUpdateType(); $modifications->setMyText("Six Six Six"); @@ -1221,7 +1221,7 @@ public function testAdvancedUpdateEqualsNull() $type = new AdvancedUpdateType(); $type->setMyReference(null); - $any = new \Good\Manners\Condition\Equality($type); + $any = new \Good\Manners\Condition\EqualTo($type); $modifications = new AdvancedUpdateType(); $modifications->setMyInt(777); @@ -1291,7 +1291,7 @@ public function testAdvancedUpdateDoesNotEqualNullIntAndText() $type = new AdvancedUpdateType(); $type->setMyInt(null); - $any = new \Good\Manners\Condition\Inequality($type); + $any = new \Good\Manners\Condition\NotEqualTo($type); $modifications = new AdvancedUpdateType(); $modifications->setMyFloat(666.666); @@ -1301,7 +1301,7 @@ public function testAdvancedUpdateDoesNotEqualNullIntAndText() $type = new AdvancedUpdateType(); $type->setMyText(null); - $any = new \Good\Manners\Condition\Inequality($type); + $any = new \Good\Manners\Condition\NotEqualTo($type); $modifications = new AdvancedUpdateType(); $modifications->setMyDatetime(new Datetime('2066-06-06')); @@ -1371,7 +1371,7 @@ public function testAdvancedUpdateDoesNotEqualNullFloatAndDate() $type = new AdvancedUpdateType(); $type->setMyFloat(null); - $any = new \Good\Manners\Condition\Inequality($type); + $any = new \Good\Manners\Condition\NotEqualTo($type); $modifications = new AdvancedUpdateType(); $modifications->setMyInt(666); @@ -1381,7 +1381,7 @@ public function testAdvancedUpdateDoesNotEqualNullFloatAndDate() $type = new AdvancedUpdateType(); $type->setMyDatetime(null); - $any = new \Good\Manners\Condition\Inequality($type); + $any = new \Good\Manners\Condition\NotEqualTo($type); $modifications = new AdvancedUpdateType(); $modifications->setMyText("Six Six Six"); @@ -1451,7 +1451,7 @@ public function testAdvancedUpdateDoesNotEqualNullReference() $type = new AdvancedUpdateType(); $type->setMyReference(null); - $any = new \Good\Manners\Condition\Inequality($type); + $any = new \Good\Manners\Condition\NotEqualTo($type); $modifications = new AdvancedUpdateType(); $modifications->setMyInt(777); @@ -1521,21 +1521,21 @@ public function testAdvancedUpdateByExistingReference() // Let's firt mess up the data a little, so we can test // it changes exactly as much as it should $type = new YetAnotherType(); - $any = new \Good\Manners\Condition\Equality($type); + $any = new \Good\Manners\Condition\EqualTo($type); $modifications = new YetAnotherType(); $modifications->setYourInt(42); $this->storage1->modifyAny($any, $modifications); // one more change: $type = new AdvancedUpdateType(); $type->setMyInt(8); - $any = new \Good\Manners\Condition\Equality($type); + $any = new \Good\Manners\Condition\EqualTo($type); $resolver = new AdvancedUpdateTypeResolver(); $resolver->resolveMyReference(); $collection = $this->storage1->getCollection($any, $resolver); $ref = $collection->getNext()->getMyReference(); $type = new AdvancedUpdateType(); $type->setMyInt(10); - $any = new \Good\Manners\Condition\Equality($type); + $any = new \Good\Manners\Condition\EqualTo($type); $modifications = new AdvancedUpdateType(); $modifications->setMyReference($ref); $this->storage1->modifyAny($any, $modifications); @@ -1544,7 +1544,7 @@ public function testAdvancedUpdateByExistingReference() // (it's already in $ref, but it would be mixing of concerns if we relied on that) $type = new AdvancedUpdateType(); $type->setMyInt(10); - $any = new \Good\Manners\Condition\Equality($type); + $any = new \Good\Manners\Condition\EqualTo($type); $resolver = new AdvancedUpdateTypeResolver(); $resolver->resolveMyReference(); $collection = $this->storage1->getCollection($any, $resolver); @@ -1554,7 +1554,7 @@ public function testAdvancedUpdateByExistingReference() $type = new AdvancedUpdateType(); $type->setMyReference($ref); - $any = new \Good\Manners\Condition\Equality($type); + $any = new \Good\Manners\Condition\EqualTo($type); $modifications = new AdvancedUpdateType(); $modifications->setMyInt(1); @@ -1624,13 +1624,13 @@ public function testAdvancedUpdateObjectAndReference() $type = new AdvancedUpdateType(); $type->setMyInt(5); - $cond1 = new \Good\Manners\Condition\Greater($type); + $cond1 = new \Good\Manners\Condition\GreaterThan($type); $type = new AdvancedUpdateType(); $type->setMyReference(new YetAnotherType()); $type->getMyReference()->setYourInt(10); - $cond2 = new \Good\Manners\Condition\Greater($type); + $cond2 = new \Good\Manners\Condition\GreaterThan($type); $any = new \Good\Manners\Condition\AndCondition($cond1, $cond2); @@ -1703,7 +1703,7 @@ public function testAdvancedUpdateObjectDeepReference() { // First insert a couple ThirdTypes into our dataset $type = new AdvancedUpdateType(); - $any = new \Good\Manners\Condition\Equality($type); + $any = new \Good\Manners\Condition\EqualTo($type); $resolver = new AdvancedUpdateTypeResolver(); $resolver->resolveRef(); $collection = $this->storage1->getCollection($any, $resolver); @@ -1753,7 +1753,7 @@ public function testAdvancedUpdateObjectDeepReference() $type->getRef()->setRef(new YetAnotherType()); $type->getRef()->getRef()->setYourInt(300); - $any = new \Good\Manners\Condition\Greater($type); + $any = new \Good\Manners\Condition\GreaterThan($type); $modifications = new AdvancedUpdateType(); $modifications->setMyInt(99999); @@ -1830,7 +1830,7 @@ public function testAdvancedUpdateObjectDeepReferenceInverse() { // First insert a couple ThirdTypes into our dataset $type = new AdvancedUpdateType(); - $any = new \Good\Manners\Condition\Equality($type); + $any = new \Good\Manners\Condition\EqualTo($type); $resolver = new AdvancedUpdateTypeResolver(); $resolver->resolveRef(); $collection = $this->storage1->getCollection($any, $resolver); @@ -1878,7 +1878,7 @@ public function testAdvancedUpdateObjectDeepReferenceInverse() $type = new AdvancedUpdateType(); $type->setMyInt(5); - $any = new \Good\Manners\Condition\Greater($type); + $any = new \Good\Manners\Condition\GreaterThan($type); $modifications = new AdvancedUpdateType(); $modifications->setRef(new ThirdType()); @@ -1959,13 +1959,13 @@ public function testCircularUpdateAndConditionBug() $type = new AdvancedUpdateType(); $type->setMyInt(5); - $cond1 = new \Good\Manners\Condition\Greater($type); + $cond1 = new \Good\Manners\Condition\GreaterThan($type); $type = new AdvancedUpdateType(); $type->setMyReference(new YetAnotherType()); $type->getMyReference()->setYourInt(10); - $cond2 = new \Good\Manners\Condition\Greater($type); + $cond2 = new \Good\Manners\Condition\GreaterThan($type); $any = new \Good\Manners\Condition\AndCondition($cond1, $cond2); diff --git a/tests/Manners/GoodMannersDeleteTest.php b/tests/Manners/GoodMannersDeleteTest.php index 0cee779..8bc8526 100644 --- a/tests/Manners/GoodMannersDeleteTest.php +++ b/tests/Manners/GoodMannersDeleteTest.php @@ -172,7 +172,7 @@ private function checkResults($expected) // At the moment we don't have a proper api to get any, // but this trick does do the same $type = new DeleteType(); - $any = new \Good\Manners\Condition\Greater($type); + $any = new \Good\Manners\Condition\GreaterThan($type); $resolver = new DeleteTypeResolver(); @@ -193,7 +193,7 @@ public function testDelete() // At the moment we don't have a proper api to get any, // but this trick does do the same $type = new DeleteType(); - $any = new \Good\Manners\Condition\Greater($type); + $any = new \Good\Manners\Condition\GreaterThan($type); $collection = $this->storage1->getCollection($any, new DeleteTypeResolver()); diff --git a/tests/Manners/GoodMannersGetTest.php b/tests/Manners/GoodMannersGetTest.php index 7de1404..f375507 100644 --- a/tests/Manners/GoodMannersGetTest.php +++ b/tests/Manners/GoodMannersGetTest.php @@ -215,7 +215,7 @@ public function testGetAll() // At the moment we don't have a proper api to get any, // but this trick does do the same $type = new GetType(); - $any = new \Good\Manners\Condition\Greater($type); + $any = new \Good\Manners\Condition\GreaterThan($type); $resolver = new GetTypeResolver(); $resolver->resolveMyOtherType(); @@ -286,11 +286,11 @@ public function testGetAll() $this->assertSame(array(), $expectedResults); } - public function testGetLess() + public function testGetLessThan() { $type = new GetType(); $type->setMyInt(5); - $any = new \Good\Manners\Condition\Less($type); + $any = new \Good\Manners\Condition\LessThan($type); $resolver = new GetTypeResolver(); $resolver->resolveMyOtherType(); @@ -319,11 +319,11 @@ public function testGetLess() $this->assertSame(array(), $expectedResults); } - public function testGetLessOrEquals() + public function testGetLessOrEqual() { $type = new GetType(); $type->setMyInt(5); - $any = new \Good\Manners\Condition\LessOrEquals($type); + $any = new \Good\Manners\Condition\LessOrEqual($type); $resolver = new GetTypeResolver(); $resolver->resolveMyOtherType(); @@ -363,11 +363,11 @@ public function testGetLessOrEquals() $this->assertSame(array(), $expectedResults); } - public function testGetGreater() + public function testGetGreaterThan() { $type = new GetType(); $type->setMyInt(5); - $any = new \Good\Manners\Condition\Greater($type); + $any = new \Good\Manners\Condition\GreaterThan($type); $resolver = new GetTypeResolver(); $resolver->resolveMyOtherType(); @@ -405,11 +405,11 @@ public function testGetGreater() $this->assertSame(array(), $expectedResults); } - public function testGetGreaterOrEquals() + public function testGetGreaterOrEqual() { $type = new GetType(); $type->setMyInt(5); - $any = new \Good\Manners\Condition\GreaterOrEquals($type); + $any = new \Good\Manners\Condition\GreaterOrEqual($type); $resolver = new GetTypeResolver(); $resolver->resolveMyOtherType(); @@ -458,11 +458,11 @@ public function testGetGreaterOrEquals() $this->assertSame(array(), $expectedResults); } - public function testGetEquality() + public function testGetEqualTo() { $type = new GetType(); $type->setMyInt(5); - $any = new \Good\Manners\Condition\Equality($type); + $any = new \Good\Manners\Condition\EqualTo($type); $resolver = new GetTypeResolver(); $resolver->resolveMyOtherType(); @@ -491,11 +491,11 @@ public function testGetEquality() $this->assertSame(array(), $expectedResults); } - public function testGetInequality() + public function testGetNotEqualTo() { $type = new GetType(); $type->setMyInt(5); - $any = new \Good\Manners\Condition\Inequality($type); + $any = new \Good\Manners\Condition\NotEqualTo($type); $resolver = new GetTypeResolver(); $resolver->resolveMyOtherType(); @@ -545,7 +545,7 @@ public function testGetInequality() } /** - * @depends testGetEquality + * @depends testGetEqualTo */ public function testGetEqualToReference() { @@ -556,7 +556,7 @@ public function testGetEqualToReference() $otherType = new OtherType(); $otherType->setYourInt(80); - $any = new \Good\Manners\Condition\Equality($otherType); + $any = new \Good\Manners\Condition\EqualTo($otherType); $collection = $this->storage->getCollection($any, new OtherTypeResolver()); @@ -565,7 +565,7 @@ public function testGetEqualToReference() // Then, we get the result with that reference $type = new GetType(); $type->setMyOtherType($referenced); - $any = new \Good\Manners\Condition\Equality($type); + $any = new \Good\Manners\Condition\EqualTo($type); $resolver = new GetTypeResolver(); $resolver->resolveMyOtherType(); @@ -605,7 +605,7 @@ public function testGetById() // We still use the same ol' trick $type = new GetType(); - $any = new \Good\Manners\Condition\Equality($type); + $any = new \Good\Manners\Condition\EqualTo($type); $resolver = new GetTypeResolver(); $resolver->resolveMyOtherType(); @@ -618,7 +618,7 @@ public function testGetById() // but this should do the trick $type = new GetType(); $type->setId($idHolder->getId()); - $any = new \Good\Manners\Condition\Equality($type); + $any = new \Good\Manners\Condition\EqualTo($type); $resolver = new GetTypeResolver(); $resolver->resolveMyOtherType(); @@ -639,18 +639,18 @@ public function testGetById() } /** - * @depends testGetLess - * @depends testGetGreater + * @depends testGetLessThan + * @depends testGetGreaterThan */ public function testGetAnd() { $type = new GetType(); $type->setMyInt(4); - $greater = new \Good\Manners\Condition\Greater($type); + $greater = new \Good\Manners\Condition\GreaterThan($type); $type = new GetType(); $type->setMyInt(10); - $less = new \Good\Manners\Condition\Less($type); + $less = new \Good\Manners\Condition\LessThan($type); $and = new \Good\Manners\Condition\AndCondition($less, $greater); @@ -693,20 +693,20 @@ public function testGetAnd() } /** - * @depends testGetLess - * @depends testGetGreater + * @depends testGetLessThan + * @depends testGetGreaterThan */ public function testGetOr() { $type = new GetType(); $type->setMyInt(5); - $greater = new \Good\Manners\Condition\Greater($type); + $greater = new \Good\Manners\Condition\GreaterThan($type); - $less = new \Good\Manners\Condition\Less($type); + $less = new \Good\Manners\Condition\LessThan($type); $type = new GetType(); $type->setMyInt(8); - $greater = new \Good\Manners\Condition\Greater($type); + $greater = new \Good\Manners\Condition\GreaterThan($type); $and = new \Good\Manners\Condition\OrCondition($less, $greater); @@ -750,7 +750,7 @@ public function testGetReferenceIsNull() { $type = new GetType(); $type->setMyOtherType(null); - $any = new \Good\Manners\Condition\Equality($type); + $any = new \Good\Manners\Condition\EqualTo($type); $resolver = new GetTypeResolver(); $resolver->resolveMyOtherType(); @@ -781,7 +781,7 @@ public function testGetReferenceIsNotNull() { $type = new GetType(); $type->setMyOtherType(null); - $any = new \Good\Manners\Condition\Inequality($type); + $any = new \Good\Manners\Condition\NotEqualTo($type); $resolver = new GetTypeResolver(); $resolver->resolveMyOtherType(); @@ -844,14 +844,14 @@ public function testGetReferenceIsNotNull() } /** - * @depends testGetLess + * @depends testGetLessThan */ public function testGetByPropertyOfReference() { $type = new GetType(); $type->setMyOtherType(new OtherType()); $type->getMyOtherType()->setYourInt(85); - $any = new \Good\Manners\Condition\Less($type); + $any = new \Good\Manners\Condition\LessThan($type); $resolver = new GetTypeResolver(); $resolver->resolveMyOtherType(); @@ -903,7 +903,7 @@ public function testGetByPropertyOfReference() } /** - * @depends testGetGreater + * @depends testGetGreaterThan * @depends testGetByPropertyOfReference */ public function testGetByTwoValuesInOneCondition() @@ -914,7 +914,7 @@ public function testGetByTwoValuesInOneCondition() $type->setMyInt(4); $type->setMyOtherType(new OtherType()); $type->getMyOtherType()->setYourInt(45); - $any = new \Good\Manners\Condition\Greater($type); + $any = new \Good\Manners\Condition\GreaterThan($type); $resolver = new GetTypeResolver(); $resolver->resolveMyOtherType(); @@ -944,14 +944,14 @@ public function testGetByTwoValuesInOneCondition() } /** - * @depends testGetGreater + * @depends testGetGreaterThan */ public function testGetByFloat() { // Ints are already tested as we use them above everywhere $type = new GetType(); $type->setMyFloat(6.0); - $any = new \Good\Manners\Condition\Greater($type); + $any = new \Good\Manners\Condition\GreaterThan($type); $resolver = new GetTypeResolver(); $resolver->resolveMyOtherType(); @@ -1001,13 +1001,13 @@ public function testGetByFloat() } /** - * @depends testGetEquality + * @depends testGetEqualTo */ public function testGetByText() { $type = new GetType(); $type->setMyText("Twenty"); - $any = new \Good\Manners\Condition\Equality($type); + $any = new \Good\Manners\Condition\EqualTo($type); $resolver = new GetTypeResolver(); $resolver->resolveMyOtherType(); @@ -1037,13 +1037,13 @@ public function testGetByText() } /** - * @depends testGetGreater + * @depends testGetGreaterThan */ public function testGetByDatetime() { $type = new GetType(); $type->setMyDatetime(new Datetime('2006-06-06')); - $any = new \Good\Manners\Condition\Greater($type); + $any = new \Good\Manners\Condition\GreaterThan($type); $resolver = new GetTypeResolver(); $resolver->resolveMyOtherType(); @@ -1082,13 +1082,13 @@ public function testGetByDatetime() } /** - * @depends testGetEquality + * @depends testGetEqualTo */ public function testGetByIntIsNull() { $type = new GetType(); $type->setMyInt(null); - $any = new \Good\Manners\Condition\Equality($type); + $any = new \Good\Manners\Condition\EqualTo($type); $resolver = new GetTypeResolver(); $resolver->resolveMyOtherType(); @@ -1118,13 +1118,13 @@ public function testGetByIntIsNull() } /** - * @depends testGetEquality + * @depends testGetEqualTo */ public function testGetByFloatIsNull() { $type = new GetType(); $type->setMyFloat(null); - $any = new \Good\Manners\Condition\Equality($type); + $any = new \Good\Manners\Condition\EqualTo($type); $resolver = new GetTypeResolver(); $resolver->resolveMyOtherType(); @@ -1154,13 +1154,13 @@ public function testGetByFloatIsNull() } /** - * @depends testGetEquality + * @depends testGetEqualTo */ public function testGetByTextIsNull() { $type = new GetType(); $type->setMyText(null); - $any = new \Good\Manners\Condition\Equality($type); + $any = new \Good\Manners\Condition\EqualTo($type); $resolver = new GetTypeResolver(); $resolver->resolveMyOtherType(); @@ -1190,13 +1190,13 @@ public function testGetByTextIsNull() } /** - * @depends testGetEquality + * @depends testGetEqualTo */ public function testGetByDatetimeIsNull() { $type = new GetType(); $type->setMyDatetime(null); - $any = new \Good\Manners\Condition\Equality($type); + $any = new \Good\Manners\Condition\EqualTo($type); $resolver = new GetTypeResolver(); $resolver->resolveMyOtherType(); @@ -1226,7 +1226,7 @@ public function testGetByDatetimeIsNull() } /** - * @depends testGetInequality + * @depends testGetNotEqualTo */ public function testGetByIntIsNotNull() { @@ -1234,7 +1234,7 @@ public function testGetByIntIsNotNull() // but this trick does do the same $type = new GetType(); $type->setMyInt(null); - $any = new \Good\Manners\Condition\Inequality($type); + $any = new \Good\Manners\Condition\NotEqualTo($type); $resolver = new GetTypeResolver(); $resolver->resolveMyOtherType(); @@ -1295,13 +1295,13 @@ public function testGetByIntIsNotNull() } /** - * @depends testGetInequality + * @depends testGetNotEqualTo */ public function testGetByFloatIsNotNull() { $type = new GetType(); $type->setMyFloat(null); - $any = new \Good\Manners\Condition\Inequality($type); + $any = new \Good\Manners\Condition\NotEqualTo($type); $resolver = new GetTypeResolver(); $resolver->resolveMyOtherType(); @@ -1362,13 +1362,13 @@ public function testGetByFloatIsNotNull() } /** - * @depends testGetInequality + * @depends testGetNotEqualTo */ public function testGetByTextIsNotNull() { $type = new GetType(); $type->setMyText(null); - $any = new \Good\Manners\Condition\Inequality($type); + $any = new \Good\Manners\Condition\NotEqualTo($type); $resolver = new GetTypeResolver(); $resolver->resolveMyOtherType(); @@ -1428,13 +1428,13 @@ public function testGetByTextIsNotNull() } /** - * @depends testGetInequality + * @depends testGetNotEqualTo */ public function testGetByDatetimeIsNotNull() { $type = new GetType(); $type->setMyDatetime(null); - $any = new \Good\Manners\Condition\Inequality($type); + $any = new \Good\Manners\Condition\NotEqualTo($type); $resolver = new GetTypeResolver(); $resolver->resolveMyOtherType(); @@ -1501,7 +1501,7 @@ public function testGetSortedAscending() { // Still the get any trick $type = new GetType(); - $any = new \Good\Manners\Condition\Greater($type); + $any = new \Good\Manners\Condition\GreaterThan($type); $resolver = new GetTypeResolver(); $resolver->resolveMyOtherType(); @@ -1596,7 +1596,7 @@ public function testGetSortedDescending() { // Still the get any trick $type = new GetType(); - $any = new \Good\Manners\Condition\Greater($type); + $any = new \Good\Manners\Condition\GreaterThan($type); $resolver = new GetTypeResolver(); $resolver->resolveMyOtherType(); @@ -1693,7 +1693,7 @@ public function testGetDoubleSorted() { // Still the get any trick $type = new GetType(); - $any = new \Good\Manners\Condition\Greater($type); + $any = new \Good\Manners\Condition\GreaterThan($type); $resolver = new GetTypeResolver(); $resolver->resolveMyOtherType(); @@ -1790,7 +1790,7 @@ public function testGetAllUnresolvedReference() { // same ol' trick for getting any $type = new GetType(); - $any = new \Good\Manners\Condition\Greater($type); + $any = new \Good\Manners\Condition\GreaterThan($type); $resolver = new GetTypeResolver(); $collection = $this->storage->getCollection($any, $resolver); @@ -1863,7 +1863,7 @@ public function testGetCircularReference() { // First, we need to create a circular reference: $type = new GetType(); - $any = new \Good\Manners\Condition\Greater($type); + $any = new \Good\Manners\Condition\GreaterThan($type); $resolver = new GetTypeResolver(); $resolver->orderByMyIntAsc(); $collection = $this->storage->getCollection($any, $resolver); @@ -1883,7 +1883,7 @@ public function testGetCircularReference() // same ol' trick for getting any $type = new GetType(); - $any = new \Good\Manners\Condition\Greater($type); + $any = new \Good\Manners\Condition\GreaterThan($type); $resolver = new GetTypeResolver(); $resolver->resolveMyCircular(); diff --git a/tests/Manners/GoodMannersInsertTest.php b/tests/Manners/GoodMannersInsertTest.php index 924d2a9..bebed00 100644 --- a/tests/Manners/GoodMannersInsertTest.php +++ b/tests/Manners/GoodMannersInsertTest.php @@ -140,7 +140,7 @@ private function checkInsertion($expected) // At the moment we don't have a proper api to get any, // but this trick does do the same $type = new InsertType(); - $any = new \Good\Manners\Condition\Greater($type); + $any = new \Good\Manners\Condition\GreaterThan($type); $resolver = new InsertTypeResolver(); $resolver->resolveMyCircularReference(); diff --git a/tests/Manners/GoodMannersPersistenceTest.php b/tests/Manners/GoodMannersPersistenceTest.php index af8bd81..43b1669 100644 --- a/tests/Manners/GoodMannersPersistenceTest.php +++ b/tests/Manners/GoodMannersPersistenceTest.php @@ -158,7 +158,7 @@ public function testGet() // At the moment we don't have a proper api to get any, // but this trick does do the same $type = new PersistenceType(); - $any = new \Good\Manners\Condition\Greater($type); + $any = new \Good\Manners\Condition\GreaterThan($type); $resolver = new PersistenceTypeResolver(); $collection = $storage->getCollection($any, $resolver); diff --git a/tests/Manners/GoodMannersSimpleUpdateTest.php b/tests/Manners/GoodMannersSimpleUpdateTest.php index b778931..81f7305 100644 --- a/tests/Manners/GoodMannersSimpleUpdateTest.php +++ b/tests/Manners/GoodMannersSimpleUpdateTest.php @@ -205,7 +205,7 @@ private function checkResults($expected) // At the moment we don't have a proper api to get any, // but this trick does do the same $type = new SimpleUpdateType(); - $any = new \Good\Manners\Condition\Greater($type); + $any = new \Good\Manners\Condition\GreaterThan($type); $resolver = new SimpleUpdateTypeResolver(); $resolver->resolveMyReference(); @@ -226,7 +226,7 @@ public function testSimpleUpdate() // At the moment we don't have a proper api to get any, // but this trick does do the same $type = new SimpleUpdateType(); - $any = new \Good\Manners\Condition\Greater($type); + $any = new \Good\Manners\Condition\GreaterThan($type); $resolver = new SimpleUpdateTypeResolver(); $resolver->resolveMyReference(); @@ -297,7 +297,7 @@ public function testSimpleUpdateSetToNull() // At the moment we don't have a proper api to get any, // but this trick does do the same $type = new SimpleUpdateType(); - $any = new \Good\Manners\Condition\Greater($type); + $any = new \Good\Manners\Condition\GreaterThan($type); $resolver = new SimpleUpdateTypeResolver(); $resolver->resolveMyReference(); @@ -380,7 +380,7 @@ public function testSimpleUpdateReferences() // At the moment we don't have a proper api to get any, // but this trick does do the same $type = new SimpleUpdateType(); - $any = new \Good\Manners\Condition\Greater($type); + $any = new \Good\Manners\Condition\GreaterThan($type); $resolver = new SimpleUpdateTypeResolver(); $resolver->resolveMyReference();