ArrayLoaderTest.php 1009 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. /*
  3. * This file is part of Composer.
  4. *
  5. * (c) Nils Adermann <naderman@naderman.de>
  6. * Jordi Boggiano <j.boggiano@seld.be>
  7. *
  8. * For the full copyright and license information, please view the LICENSE
  9. * file that was distributed with this source code.
  10. */
  11. namespace Composer\Test\Package\Loader;
  12. use Composer\Package\Loader\ArrayLoader;
  13. class ArrayLoaderTest extends \PHPUnit_Framework_TestCase
  14. {
  15. public function setUp()
  16. {
  17. $this->manager = $this->getMock('Composer\Repository\RepositoryManager');
  18. $this->loader = new ArrayLoader($this->manager);
  19. }
  20. public function testSelfVersion()
  21. {
  22. $config = array(
  23. 'name' => 'A',
  24. 'version' => '1.2.3.4',
  25. 'replace' => array(
  26. 'foo' => 'self.version',
  27. ),
  28. );
  29. $package = $this->loader->load($config);
  30. $replaces = $package->getReplaces();
  31. $this->assertEquals('== 1.2.3.4', (string) $replaces[0]->getConstraint());
  32. }
  33. }