TestClient.php 795 B

12345678910111213141516171819202122232425262728293031
  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\HttpKernel\Tests\Fixtures;
  11. use Symfony\Component\HttpKernel\Client;
  12. class TestClient extends Client
  13. {
  14. protected function getScript($request)
  15. {
  16. $script = parent::getScript($request);
  17. $autoload = file_exists(__DIR__.'/../../vendor/autoload.php')
  18. ? __DIR__.'/../../vendor/autoload.php'
  19. : __DIR__.'/../../../../../../vendor/autoload.php'
  20. ;
  21. $script = preg_replace('/(\->register\(\);)/', "$0\nrequire_once '$autoload';\n", $script);
  22. return $script;
  23. }
  24. }