diff --git a/lib/Magomogo/Persisted/AbstractProperties.php b/lib/Magomogo/Persisted/AbstractProperties.php index cdcc47c..893a39c 100644 --- a/lib/Magomogo/Persisted/AbstractProperties.php +++ b/lib/Magomogo/Persisted/AbstractProperties.php @@ -42,12 +42,6 @@ public function id($container) $this->idInContainer[get_class($container)] : null; } - public function resetPersistency() - { - $this->idInContainer = array(); - return $this; - } - public function naturalKey() { return null; diff --git a/lib/Magomogo/Persisted/PropertiesInterface.php b/lib/Magomogo/Persisted/PropertiesInterface.php new file mode 100644 index 0000000..16852e4 --- /dev/null +++ b/lib/Magomogo/Persisted/PropertiesInterface.php @@ -0,0 +1,64 @@ +assertFalse(isset(self::properties()->not_existing)); } - public function testPersistencyCanBeReset() - { - $bag = self::properties(); - $bag->persisted(88, new \stdClass()); - $this->assertEquals(88, $bag->id(new \stdClass())); - $this->assertNull($bag->resetPersistency()->id(new \stdClass())); - } - //---------------------------------------------------------------------------------------------------------------------- private static function properties() diff --git a/test/Persisted/Container/MemoryTest.php b/test/Persisted/Container/MemoryTest.php index e0e2814..ebc34c4 100644 --- a/test/Persisted/Container/MemoryTest.php +++ b/test/Persisted/Container/MemoryTest.php @@ -106,7 +106,7 @@ public function testCanSaveAndLoadAJobRecord() $jobRecord = new JobRecord\Model(ObjectMother\Company::xiag(), ObjectMother\Company::nstu()); $id = $jobRecord->save($container); - $this->assertModelsAreEqual( + $this->assertEquals( $jobRecord, JobRecord\Model::load($container, $id) ); @@ -128,17 +128,4 @@ public function testProvidesCorrectInstanceOfAggregatedProperties() $personProperties->creditCard->paymentSystem() ); } - - /** - * @param ModelInterface $model1 - * @param ModelInterface $model2 - */ - private function assertModelsAreEqual($model1, $model2) - { - $container = new Memory(); - $this->assertEquals( - $container->exposeProperties($model1)->resetPersistency(), - $container->exposeProperties($model2)->resetPersistency() - ); - } }