PropertyAccessorBuilderTest.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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 PHPUnit\Framework\TestCase;
  12. use Symfony\Component\PropertyAccess\PropertyAccessorBuilder;
  13. class PropertyAccessorBuilderTest extends TestCase
  14. {
  15. /**
  16. * @var PropertyAccessorBuilder
  17. */
  18. protected $builder;
  19. protected function setUp()
  20. {
  21. $this->builder = new PropertyAccessorBuilder();
  22. }
  23. protected function tearDown()
  24. {
  25. $this->builder = null;
  26. }
  27. public function testEnableMagicCall()
  28. {
  29. $this->assertSame($this->builder, $this->builder->enableMagicCall());
  30. }
  31. public function testDisableMagicCall()
  32. {
  33. $this->assertSame($this->builder, $this->builder->disableMagicCall());
  34. }
  35. public function testIsMagicCallEnable()
  36. {
  37. $this->assertFalse($this->builder->isMagicCallEnabled());
  38. $this->assertTrue($this->builder->enableMagicCall()->isMagicCallEnabled());
  39. $this->assertFalse($this->builder->disableMagicCall()->isMagicCallEnabled());
  40. }
  41. public function testGetPropertyAccessor()
  42. {
  43. $this->assertInstanceOf('Symfony\Component\PropertyAccess\PropertyAccessor', $this->builder->getPropertyAccessor());
  44. $this->assertInstanceOf('Symfony\Component\PropertyAccess\PropertyAccessor', $this->builder->enableMagicCall()->getPropertyAccessor());
  45. }
  46. }