ComposerResourceTest.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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\Config\Tests\Resource;
  11. use Composer\Autoload\ClassLoader;
  12. use PHPUnit\Framework\TestCase;
  13. use Symfony\Component\Config\Resource\ComposerResource;
  14. class ComposerResourceTest extends TestCase
  15. {
  16. public function testGetVendor()
  17. {
  18. $res = new ComposerResource();
  19. $r = new \ReflectionClass(ClassLoader::class);
  20. $found = false;
  21. foreach ($res->getVendors() as $vendor) {
  22. if ($vendor && 0 === strpos($r->getFileName(), $vendor)) {
  23. $found = true;
  24. break;
  25. }
  26. }
  27. $this->assertTrue($found);
  28. }
  29. public function testSerializeUnserialize()
  30. {
  31. $res = new ComposerResource();
  32. $ser = unserialize(serialize($res));
  33. $this->assertTrue($res->isFresh(0));
  34. $this->assertTrue($ser->isFresh(0));
  35. $this->assertEquals($res, $ser);
  36. }
  37. }