FrozenParameterBagTest.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. * (c) Fabien Potencier <fabien.potencier@symfony-project.com>
  5. *
  6. * For the full copyright and license information, please view the LICENSE
  7. * file that was distributed with this source code.
  8. */
  9. namespace Symfony\Tests\Component\DependencyInjection\ParameterBag;
  10. use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag;
  11. class FrozenParameterBagTest extends \PHPUnit_Framework_TestCase
  12. {
  13. /**
  14. * @covers Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag::__construct
  15. */
  16. public function testConstructor()
  17. {
  18. $parameters = array(
  19. 'foo' => 'foo',
  20. 'bar' => 'bar',
  21. );
  22. $bag = new FrozenParameterBag($parameters);
  23. $this->assertEquals($parameters, $bag->all(), '__construct() takes an array of parameters as its first argument');
  24. }
  25. /**
  26. * @covers Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag::clear
  27. * @expectedException \LogicException
  28. */
  29. public function testClear()
  30. {
  31. $bag = new FrozenParameterBag(array());
  32. $bag->clear();
  33. }
  34. /**
  35. * @covers Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag::set
  36. * @expectedException \LogicException
  37. */
  38. public function testSet()
  39. {
  40. $bag = new FrozenParameterBag(array());
  41. $bag->set('foo', 'bar');
  42. }
  43. /**
  44. * @covers Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag::add
  45. * @expectedException \LogicException
  46. */
  47. public function testAdd()
  48. {
  49. $bag = new FrozenParameterBag(array());
  50. $bag->add(array());
  51. }
  52. }