Skip to content
This repository has been archived by the owner on Jan 24, 2020. It is now read-only.

Commit

Permalink
Fixed the tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Satans Krümelmonster authored and TomHAnderson committed Mar 30, 2018
1 parent 79e70a3 commit f49b186
Showing 1 changed file with 26 additions and 6 deletions.
32 changes: 26 additions & 6 deletions tests/DoctrineModuleTest/Stdlib/Hydrator/DoctrineObjectTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2567,19 +2567,29 @@ public function testDefaultStrategy()

$entity = new Asset\OneToManyEntity();

$this->hydratorByValue->extract($entity);
$this->hydratorByValue->hydrate(array(), $entity);

$this->assertEquals(
'DoctrineModule\Stdlib\Hydrator\Strategy\AllowRemoveByValue',
$this->hydratorByValue->getDefaultByValueStrategy()
);

$this->hydratorByReference->extract($entity);
$this->assertInstanceOf(
'DoctrineModule\Stdlib\Hydrator\Strategy\AllowRemoveByValue',
$this->hydratorByValue->getStrategy('entities')
);

$this->hydratorByReference->hydrate(array(), $entity);

$this->assertEquals(
'DoctrineModule\Stdlib\Hydrator\Strategy\AllowRemoveByReference',
$this->hydratorByReference->getDefaultByReferenceStrategy()
);

$this->assertInstanceOf(
'DoctrineModule\Stdlib\Hydrator\Strategy\AllowRemoveByReference',
$this->hydratorByReference->getStrategy('entities')
);
}

/**
Expand All @@ -2590,22 +2600,32 @@ public function testOverrideDefaultStrategy()
$this->configureObjectManagerForOneToManyEntity();

$this->hydratorByValue->setDefaultByValueStrategy(__NAMESPACE__ . '\Asset\DifferentAllowRemoveByValue');
$this->hydratorByReference->setDefaultByValueStrategy(__NAMESPACE__ . '\Asset\DifferentAllowRemoveByReference');
$this->hydratorByReference->setDefaultByReferenceStrategy(__NAMESPACE__ . '\Asset\DifferentAllowRemoveByReference');

$entity = new Asset\OneToManyEntity();

$this->hydratorByValue->extract($entity);
$this->hydratorByValue->hydrate(array(), $entity);

$this->assertEquals(
__NAMESPACE__ . '\Asset\DifferentAllowRemoveByValue',
$this->hydratorByValue->getDefaultByValueStrategy()
);

$this->hydratorByReference->extract($entity);
$this->assertInstanceOf(
__NAMESPACE__ . '\Asset\DifferentAllowRemoveByValue',
$this->hydratorByValue->getStrategy('entities')
);

$this->hydratorByReference->hydrate(array(), $entity);

$this->assertEquals(
__NAMESPACE__ . '\Asset\DifferentAllowRemoveByReference',
$this->hydratorByReference->getDefaultByValueStrategy()
$this->hydratorByReference->getDefaultByReferenceStrategy()
);

$this->assertInstanceOf(
__NAMESPACE__ . '\Asset\DifferentAllowRemoveByReference',
$this->hydratorByReference->getStrategy('entities')
);
}
}

0 comments on commit f49b186

Please sign in to comment.