Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[PropertyAccess] Refactored PropertyAccessorTest
- Loading branch information
Showing
8 changed files
with
335 additions
and
391 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
71 changes: 0 additions & 71 deletions
71
src/Symfony/Component/PropertyAccess/Tests/Fixtures/Author.php
This file was deleted.
Oops, something went wrong.
27 changes: 0 additions & 27 deletions
27
src/Symfony/Component/PropertyAccess/Tests/Fixtures/Magician.php
This file was deleted.
Oops, something went wrong.
28 changes: 0 additions & 28 deletions
28
src/Symfony/Component/PropertyAccess/Tests/Fixtures/MagicianCall.php
This file was deleted.
Oops, something went wrong.
115 changes: 115 additions & 0 deletions
115
src/Symfony/Component/PropertyAccess/Tests/Fixtures/TestClass.php
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,115 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <fabien@symfony.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Symfony\Component\PropertyAccess\Tests\Fixtures; | ||
|
||
class TestClass | ||
{ | ||
public $publicProperty; | ||
protected $protectedProperty; | ||
private $privateProperty; | ||
|
||
private $publicAccessor; | ||
private $publicIsAccessor; | ||
private $publicHasAccessor; | ||
|
||
public function __construct($value) | ||
{ | ||
$this->publicProperty = $value; | ||
$this->publicAccessor = $value; | ||
$this->publicIsAccessor = $value; | ||
$this->publicHasAccessor = $value; | ||
} | ||
|
||
public function setPublicAccessor($value) | ||
{ | ||
$this->publicAccessor = $value; | ||
} | ||
|
||
public function getPublicAccessor() | ||
{ | ||
return $this->publicAccessor; | ||
} | ||
|
||
public function setPublicIsAccessor($value) | ||
{ | ||
$this->publicIsAccessor = $value; | ||
} | ||
|
||
public function isPublicIsAccessor() | ||
{ | ||
return $this->publicIsAccessor; | ||
} | ||
|
||
public function setPublicHasAccessor($value) | ||
{ | ||
$this->publicHasAccessor = $value; | ||
} | ||
|
||
public function hasPublicHasAccessor() | ||
{ | ||
return $this->publicHasAccessor; | ||
} | ||
|
||
protected function setProtectedAccessor($value) | ||
{ | ||
} | ||
|
||
protected function getProtectedAccessor() | ||
{ | ||
return 'foobar'; | ||
} | ||
|
||
protected function setProtectedIsAccessor($value) | ||
{ | ||
} | ||
|
||
protected function isProtectedIsAccessor() | ||
{ | ||
return 'foobar'; | ||
} | ||
|
||
protected function setProtectedHasAccessor($value) | ||
{ | ||
} | ||
|
||
protected function hasProtectedHasAccessor() | ||
{ | ||
return 'foobar'; | ||
} | ||
|
||
private function setPrivateAccessor($value) | ||
{ | ||
} | ||
|
||
private function getPrivateAccessor() | ||
{ | ||
return 'foobar'; | ||
} | ||
|
||
private function setPrivateIsAccessor($value) | ||
{ | ||
} | ||
|
||
private function isPrivateIsAccessor() | ||
{ | ||
return 'foobar'; | ||
} | ||
|
||
private function setPrivateHasAccessor($value) | ||
{ | ||
} | ||
|
||
private function hasPrivateHasAccessor() | ||
{ | ||
return 'foobar'; | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
src/Symfony/Component/PropertyAccess/Tests/Fixtures/TestClassMagicCall.php
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,39 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <fabien@symfony.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Symfony\Component\PropertyAccess\Tests\Fixtures; | ||
|
||
class TestClassMagicCall | ||
{ | ||
private $magicCallProperty; | ||
|
||
public function __construct($value) | ||
{ | ||
$this->magicCallProperty = $value; | ||
} | ||
|
||
public function __call($method, array $args) | ||
{ | ||
if ('getMagicCallProperty' === $method) { | ||
return $this->magicCallProperty; | ||
} | ||
|
||
if ('getConstantMagicCallProperty' === $method) { | ||
return 'constant value'; | ||
} | ||
|
||
if ('setMagicCallProperty' === $method) { | ||
$this->magicCallProperty = reset($args); | ||
} | ||
|
||
return null; | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
src/Symfony/Component/PropertyAccess/Tests/Fixtures/TestClassMagicGet.php
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,42 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <fabien@symfony.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Symfony\Component\PropertyAccess\Tests\Fixtures; | ||
|
||
class TestClassMagicGet | ||
{ | ||
private $magicProperty; | ||
|
||
public function __construct($value) | ||
{ | ||
$this->magicProperty = $value; | ||
} | ||
|
||
public function __set($property, $value) | ||
{ | ||
if ('magicProperty' === $property) { | ||
$this->magicProperty = $value; | ||
} | ||
} | ||
|
||
public function __get($property) | ||
{ | ||
if ('magicProperty' === $property) { | ||
return $this->magicProperty; | ||
} | ||
|
||
if ('constantMagicProperty' === $property) { | ||
return 'constant value'; | ||
} | ||
|
||
return null; | ||
} | ||
} |
Oops, something went wrong.