DataCollectorTest.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  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\DataCollector;
  11. use PHPUnit\Framework\TestCase;
  12. use Symfony\Component\HttpFoundation\Request;
  13. use Symfony\Component\HttpFoundation\Response;
  14. use Symfony\Component\HttpKernel\Tests\Fixtures\DataCollector\CloneVarDataCollector;
  15. use Symfony\Component\VarDumper\Cloner\VarCloner;
  16. class DataCollectorTest extends TestCase
  17. {
  18. public function testCloneVarStringWithScheme()
  19. {
  20. $c = new CloneVarDataCollector('scheme://foo');
  21. $c->collect(new Request(), new Response());
  22. $cloner = new VarCloner();
  23. $this->assertEquals($cloner->cloneVar('scheme://foo'), $c->getData());
  24. }
  25. public function testCloneVarExistingFilePath()
  26. {
  27. $c = new CloneVarDataCollector([$filePath = tempnam(sys_get_temp_dir(), 'clone_var_data_collector_')]);
  28. $c->collect(new Request(), new Response());
  29. $this->assertSame($filePath, $c->getData()[0]);
  30. }
  31. }