-
-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
entity: fix setReadOnlyValue on IPropertyContainer [closes #130]
- Loading branch information
Showing
2 changed files
with
43 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
tests/cases/integration/Entity/entity.setReadOnlyValue().phpt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
|
||
/** | ||
* @testCase | ||
* @dataProvider ../../../sections.ini | ||
*/ | ||
|
||
namespace NextrasTests\Orm\Integration\Entity; | ||
|
||
use Mockery; | ||
use NextrasTests\Orm\DataTestCase; | ||
use NextrasTests\Orm\Ean; | ||
use NextrasTests\Orm\TagFollower; | ||
use Tester\Assert; | ||
|
||
$dic = require_once __DIR__ . '/../../../bootstrap.php'; | ||
|
||
|
||
class EntitySetReadOnlyValueTest extends DataTestCase | ||
{ | ||
|
||
public function testWithIPropertyContainer() | ||
{ | ||
$tagA = $this->orm->tags->getById(1); | ||
$tagB = $this->orm->tags->getById(2); | ||
|
||
$follower = new TagFollower(); | ||
$follower->tag = $tagA; | ||
|
||
$follower->getMetadata()->getProperty('tag')->isReadonly = TRUE; | ||
|
||
$follower->setReadOnlyValue('tag', $tagB); | ||
|
||
Assert::same($tagB, $follower->tag); | ||
} | ||
|
||
} | ||
|
||
|
||
$test = new EntitySetReadOnlyValueTest($dic); | ||
$test->run(); |