PropertyAccessorBuilderTest.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\PropertyAccess\Tests;
  11. use Symfony\Component\PropertyAccess\PropertyAccessorBuilder;
  12. class PropertyAccessorBuilderTest extends \PHPUnit_Framework_TestCase
  13. {
  14. /**
  15. * @var PropertyAccessorBuilder
  16. */
  17. protected $builder;
  18. protected function setUp()
  19. {
  20. $this->builder = new PropertyAccessorBuilder();
  21. }
  22. protected function tearDown()
  23. {
  24. $this->builder = null;
  25. }
  26. public function testEnableMagicCall()
  27. {
  28. $this->assertSame($this->builder, $this->builder->enableMagicCall());
  29. }
  30. public function testDisableMagicCall()
  31. {
  32. $this->assertSame($this->builder, $this->builder->disableMagicCall());
  33. }
  34. public function testIsMagicCallEnable()
  35. {
  36. $this->assertFalse($this->builder->isMagicCallEnabled());
  37. $this->assertTrue($this->builder->enableMagicCall()->isMagicCallEnabled());
  38. $this->assertFalse($this->builder->disableMagicCall()->isMagicCallEnabled());
  39. }
  40. public function testGetPropertyAccessor()
  41. {
  42. $this->assertInstanceOf('Symfony\Component\PropertyAccess\PropertyAccessor', $this->builder->getPropertyAccessor());
  43. $this->assertInstanceOf('Symfony\Component\PropertyAccess\PropertyAccessor', $this->builder->enableMagicCall()->getPropertyAccessor());
  44. }
  45. }