Skip to content

Commit

Permalink
Use Symfony\Component\Filesystem\Filesystem to remove test files (#5861)
Browse files Browse the repository at this point in the history
This makes these tests work on Windows
  • Loading branch information
jorrit committed Jan 31, 2020
1 parent d2b91ac commit fd21592
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 3 additions & 2 deletions tests/Admin/AdminTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
use Sonata\Doctrine\Adapter\AdapterInterface;
use Symfony\Component\DependencyInjection\Container;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Form\FormBuilder;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormEvent;
Expand All @@ -80,8 +81,8 @@ class AdminTest extends TestCase
public function setUp(): void
{
$this->cacheTempFolder = sys_get_temp_dir().'/sonata_test_route';

exec('rm -rf '.$this->cacheTempFolder);
$filesystem = new Filesystem();
$filesystem->remove($this->cacheTempFolder);
}

/**
Expand Down
4 changes: 3 additions & 1 deletion tests/Route/DefaultRouteGeneratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
use Sonata\AdminBundle\Route\DefaultRouteGenerator;
use Sonata\AdminBundle\Route\RouteCollection;
use Sonata\AdminBundle\Route\RoutesCache;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\HttpFoundation\ParameterBag;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\RouterInterface;
Expand All @@ -31,7 +32,8 @@ public function setUp(): void
{
$this->cacheTempFolder = sys_get_temp_dir().'/sonata_test_route';

exec('rm -rf '.$this->cacheTempFolder);
$filesystem = new Filesystem();
$filesystem->remove($this->cacheTempFolder);
}

public function testGenerate(): void
Expand Down

0 comments on commit fd21592

Please sign in to comment.