Skip to content

Commit

Permalink
Added tests to ensure setting a private/protected property is depreca…
Browse files Browse the repository at this point in the history
…ted (#816)
  • Loading branch information
theofidry committed Oct 20, 2017
1 parent 2b9b27a commit c5a129a
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/Nelmio/Alice/Fixtures/LoaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,25 @@ public function testLoadAssignsDataToNonPublicSetters()
$this->assertEquals('group', $group->getSortName());
}

/**
* @group legacy
*/
public function testLoadAssignsDataToDirectlyWithReflection()
{
$res = $this->loadData([
Group::class => [
'a' => [
'foo' => 'bar',
],
],
]);
/** @var Group $group */
$group = $res['a'];

$this->assertEquals('bar', $group->getFoo());
}


public function testSnakeCaseProperty()
{
$res = $this->loadData([
Expand Down
6 changes: 6 additions & 0 deletions tests/Nelmio/Alice/support/models/Group.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class Group
private $supportEmails = [];
public $contactPerson;
public $contactPersonName;
private $foo;

public function getName()
{
Expand Down Expand Up @@ -83,4 +84,9 @@ public function getSupportEmails()
{
return $this->supportEmails;
}

public function getFoo()
{
return $this->foo;
}
}

0 comments on commit c5a129a

Please sign in to comment.