Skip to content

Commit

Permalink
Merge pull request KnpLabs#266 from stof/phpunit_6
Browse files Browse the repository at this point in the history
Use namespaced PHPUnit classes in the testsuite
  • Loading branch information
stof authored Aug 22, 2017
2 parents c601e59 + 24b81bb commit c9f9c15
Show file tree
Hide file tree
Showing 25 changed files with 54 additions and 40 deletions.
8 changes: 2 additions & 6 deletions tests/Knp/Menu/Tests/Factory/CoreExtensionTest.php
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
<?php
/**
* @author: bchoquet
*/

namespace Knp\Menu\Tests\Factory;


use Knp\Menu\Factory\CoreExtension;
use Knp\Menu\MenuFactory;
use Knp\Menu\MenuItem;
use PHPUnit\Framework\TestCase;

class CoreExtensionTest extends \PHPUnit_Framework_TestCase
class CoreExtensionTest extends TestCase
{
public function testBuildOptions()
{
Expand Down Expand Up @@ -90,4 +87,3 @@ private function createItem( $name )
return $item;
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@
use Knp\Menu\Matcher\Matcher;
use Knp\Menu\Integration\Silex\KnpMenuServiceProvider;
use Knp\Menu\Matcher\Voter\RouteVoter;
use PHPUnit\Framework\TestCase;
use Silex\Application;
use Silex\Provider\TwigServiceProvider;
use Silex\Provider\UrlGeneratorServiceProvider;
use Symfony\Component\HttpFoundation\Request;

class KnpMenuServiceProviderTest extends \PHPUnit_Framework_TestCase
class KnpMenuServiceProviderTest extends TestCase
{
public function setUp()
protected function setUp()
{
if (!class_exists('Silex\Application')) {
$this->markTestSkipped('Silex is not available');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
namespace Knp\Menu\Tests\Silex;

use Knp\Menu\Integration\Symfony\RoutingExtension;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;

class RoutingExtensionTest extends \PHPUnit_Framework_TestCase
class RoutingExtensionTest extends TestCase
{
public function setUp()
protected function setUp()
{
if (!interface_exists('Symfony\Component\Routing\Generator\UrlGeneratorInterface')) {
$this->markTestSkipped('The Symfony Routing component is not available');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
use Knp\Menu\Iterator\CurrentItemFilterIterator;
use Knp\Menu\Iterator\RecursiveItemIterator;
use Knp\Menu\Matcher\Matcher;
use Knp\Menu\Tests\TestCase;
use Knp\Menu\Tests\MenuTestCase;

class CurrentItemFilterIteratorTest extends TestCase
class CurrentItemFilterIteratorTest extends MenuTestCase
{
public function testSimpleFiltering()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

use Knp\Menu\Iterator\DisplayedItemFilterIterator;
use Knp\Menu\Iterator\RecursiveItemIterator;
use Knp\Menu\Tests\TestCase;
use Knp\Menu\Tests\MenuTestCase;

class DisplayedItemFilterIteratorTest extends TestCase
class DisplayedItemFilterIteratorTest extends MenuTestCase
{
public function testFiltering()
{
Expand Down
4 changes: 2 additions & 2 deletions tests/Knp/Menu/Tests/Iterator/IteratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
namespace Knp\Menu\Tests\Iterator;

use Knp\Menu\Iterator\RecursiveItemIterator;
use Knp\Menu\Tests\TestCase;
use Knp\Menu\Tests\MenuTestCase;

class IteratorTest extends TestCase
class IteratorTest extends MenuTestCase
{
public function testIterator()
{
Expand Down
3 changes: 2 additions & 1 deletion tests/Knp/Menu/Tests/Loader/ArrayLoaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@

use Knp\Menu\Loader\ArrayLoader;
use Knp\Menu\MenuFactory;
use PHPUnit\Framework\TestCase;

class ArrayLoaderTest extends \PHPUnit_Framework_TestCase
class ArrayLoaderTest extends TestCase
{
public function testLoadWithoutChildren()
{
Expand Down
3 changes: 2 additions & 1 deletion tests/Knp/Menu/Tests/Matcher/MatcherTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
namespace Knp\Menu\Tests\Matcher;

use Knp\Menu\Matcher\Matcher;
use PHPUnit\Framework\TestCase;

class MatcherTest extends \PHPUnit_Framework_TestCase
class MatcherTest extends TestCase
{
/**
* @param boolean|null $flag
Expand Down
3 changes: 2 additions & 1 deletion tests/Knp/Menu/Tests/Matcher/Voter/RegexVoterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
namespace Knp\Menu\Tests\Matcher\Voter;

use Knp\Menu\Matcher\Voter\RegexVoter;
use PHPUnit\Framework\TestCase;

class RegexVoterTest extends \PHPUnit_Framework_TestCase
class RegexVoterTest extends TestCase
{
/**
* @param string $exp
Expand Down
3 changes: 2 additions & 1 deletion tests/Knp/Menu/Tests/Matcher/Voter/RouteVoterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
namespace Knp\Menu\Tests\Matcher\Voter;

use Knp\Menu\Matcher\Voter\RouteVoter;
use PHPUnit\Framework\TestCase;
use Symfony\Component\HttpFoundation\Request;

class RouteVoterTest extends \PHPUnit_Framework_TestCase
class RouteVoterTest extends TestCase
{
protected function setUp()
{
Expand Down
3 changes: 2 additions & 1 deletion tests/Knp/Menu/Tests/Matcher/Voter/UriVoterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
namespace Knp\Menu\Tests\Matcher\Voter;

use Knp\Menu\Matcher\Voter\UriVoter;
use PHPUnit\Framework\TestCase;

class UriVoterTest extends \PHPUnit_Framework_TestCase
class UriVoterTest extends TestCase
{
/**
* @param string $uri
Expand Down
3 changes: 2 additions & 1 deletion tests/Knp/Menu/Tests/MenuFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
namespace Knp\Menu\Tests;

use Knp\Menu\MenuFactory;
use PHPUnit\Framework\TestCase;

class MenuFactoryTest extends \PHPUnit_Framework_TestCase
class MenuFactoryTest extends TestCase
{
public function testExtensions()
{
Expand Down
3 changes: 2 additions & 1 deletion tests/Knp/Menu/Tests/MenuItemGetterSetterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@

use Knp\Menu\MenuItem;
use Knp\Menu\MenuFactory;
use PHPUnit\Framework\TestCase;

class MenuItemGetterSetterTest extends \PHPUnit_Framework_TestCase
class MenuItemGetterSetterTest extends TestCase
{
public function testCreateMenuItemWithEmptyParameter()
{
Expand Down
3 changes: 2 additions & 1 deletion tests/Knp/Menu/Tests/MenuItemReorderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@

use Knp\Menu\MenuItem;
use Knp\Menu\MenuFactory;
use PHPUnit\Framework\TestCase;

class MenuItemReorderTest extends \PHPUnit_Framework_TestCase
class MenuItemReorderTest extends TestCase
{
public function testReordering()
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Knp/Menu/Tests/MenuItemTreeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

class TestMenuItem extends MenuItem {}

class MenuItemTreeTest extends TestCase
class MenuItemTreeTest extends MenuTestCase
{
public function testSampleTreeIntegrity()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@

use Knp\Menu\MenuItem;
use Knp\Menu\MenuFactory;
use PHPUnit\Framework\TestCase;

abstract class TestCase extends \PHPUnit_Framework_TestCase
abstract class MenuTestCase extends TestCase
{
/**
* @var \Knp\Menu\MenuItem
Expand Down
3 changes: 2 additions & 1 deletion tests/Knp/Menu/Tests/Provider/ArrayAccessProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
namespace Knp\Menu\Tests\Provider;

use Knp\Menu\Provider\ArrayAccessProvider;
use PHPUnit\Framework\TestCase;

class ArrayAccessProviderTest extends \PHPUnit_Framework_TestCase
class ArrayAccessProviderTest extends TestCase
{
public function testHas()
{
Expand Down
3 changes: 2 additions & 1 deletion tests/Knp/Menu/Tests/Provider/ChainProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
namespace Knp\Menu\Tests\Provider;

use Knp\Menu\Provider\ChainProvider;
use PHPUnit\Framework\TestCase;

class ChainProviderTest extends \PHPUnit_Framework_TestCase
class ChainProviderTest extends TestCase
{
public function testHas()
{
Expand Down
5 changes: 3 additions & 2 deletions tests/Knp/Menu/Tests/Provider/PimpleProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
namespace Knp\Menu\Tests\Provider;

use Knp\Menu\Provider\PimpleProvider;
use PHPUnit\Framework\TestCase;

/**
* @group legacy
*/
class PimpleProviderTest extends \PHPUnit_Framework_TestCase
class PimpleProviderTest extends TestCase
{
public function setUp()
protected function setUp()
{
if (!class_exists('Pimple')) {
$this->markTestSkipped('Pimple is not available');
Expand Down
4 changes: 2 additions & 2 deletions tests/Knp/Menu/Tests/Renderer/AbstractRendererTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
use Knp\Menu\MenuFactory;
use Knp\Menu\Matcher\MatcherInterface;
use Knp\Menu\Matcher\Matcher;
use Knp\Menu\Tests\TestCase;
use Knp\Menu\Tests\MenuTestCase;

abstract class AbstractRendererTest extends TestCase
abstract class AbstractRendererTest extends MenuTestCase
{
/**
* @var \Knp\Menu\Renderer\RendererInterface
Expand Down
3 changes: 2 additions & 1 deletion tests/Knp/Menu/Tests/Renderer/ArrayAccessProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
namespace Knp\Menu\Tests\Renderer;

use Knp\Menu\Renderer\ArrayAccessProvider;
use PHPUnit\Framework\TestCase;

class ArrayAccessProviderTest extends \PHPUnit_Framework_TestCase
class ArrayAccessProviderTest extends TestCase
{
public function testHas()
{
Expand Down
5 changes: 3 additions & 2 deletions tests/Knp/Menu/Tests/Renderer/PimpleProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
namespace Knp\Menu\Tests\Renderer;

use Knp\Menu\Renderer\PimpleProvider;
use PHPUnit\Framework\TestCase;

/**
* @group legacy
*/
class PimpleProviderTest extends \PHPUnit_Framework_TestCase
class PimpleProviderTest extends TestCase
{
public function setUp()
protected function setUp()
{
if (!class_exists('Pimple')) {
$this->markTestSkipped('Pimple is not available');
Expand Down
3 changes: 2 additions & 1 deletion tests/Knp/Menu/Tests/Twig/HelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
use Knp\Menu\MenuFactory;
use Knp\Menu\MenuItem;
use Knp\Menu\Twig\Helper;
use PHPUnit\Framework\TestCase;

class HelperTest extends \PHPUnit_Framework_TestCase
class HelperTest extends TestCase
{
public function testRenderMenu()
{
Expand Down
5 changes: 3 additions & 2 deletions tests/Knp/Menu/Tests/Twig/MenuExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
namespace Knp\Menu\Tests\Twig;

use Knp\Menu\Twig\MenuExtension;
use PHPUnit\Framework\TestCase;

class MenuExtensionTest extends \PHPUnit_Framework_TestCase
class MenuExtensionTest extends TestCase
{
public function setUp()
protected function setUp()
{
if (!class_exists('Twig_Environment')) {
$this->markTestSkipped('Twig is not available');
Expand Down
4 changes: 2 additions & 2 deletions tests/Knp/Menu/Tests/Util/MenuManipulatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

use Knp\Menu\MenuFactory;
use Knp\Menu\MenuItem;
use Knp\Menu\Tests\TestCase;
use Knp\Menu\Tests\MenuTestCase;
use Knp\Menu\Util\MenuManipulator;

class MenuManipulatorTest extends TestCase
class MenuManipulatorTest extends MenuTestCase
{
public function testMoveToFirstPosition()
{
Expand Down

0 comments on commit c9f9c15

Please sign in to comment.