Skip to content

Commit

Permalink
Fixed tests after cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
wouterj committed Jan 5, 2017
1 parent 2324474 commit 0aa8838
Show file tree
Hide file tree
Showing 18 changed files with 32 additions and 30 deletions.
4 changes: 4 additions & 0 deletions src/ChainRouter.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,10 @@ protected function sortRouters()
{
krsort($this->routers);

if (0 === count($this->routers)) {
return array();
}

return call_user_func_array('array_merge', $this->routers);
}

Expand Down
4 changes: 4 additions & 0 deletions src/DynamicRouter.php
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,10 @@ protected function sortRouteEnhancers()
{
krsort($this->enhancers);

if (0 === count($this->enhancers)) {
return array();
}

return call_user_func_array('array_merge', $this->enhancers);
}

Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Candidates/CandidatesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/

namespace Symfony\Cmf\Component\Routing\Tests\Candidates;
namespace Symfony\Cmf\Component\Routing\Tests\Unit\Candidates;

use Symfony\Cmf\Component\Routing\Candidates\Candidates;
use Symfony\Component\HttpFoundation\Request;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/

namespace Symfony\Cmf\Component\Routing\Tests\DependencyInjection\Compiler;
namespace Symfony\Cmf\Component\Routing\Tests\Unit\DependencyInjection\Compiler;

use Symfony\Cmf\Component\Routing\DependencyInjection\Compiler\RegisterRouteEnhancersPass;
use Symfony\Component\DependencyInjection\Definition;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/

namespace Symfony\Cmf\Routing\Tests\DependencyInjection\Compiler;
namespace Symfony\Cmf\Routing\Tests\Unit\DependencyInjection\Compiler;

use Symfony\Cmf\Component\Routing\DependencyInjection\Compiler\RegisterRoutersPass;
use Symfony\Component\DependencyInjection\Reference;
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Enhancer/ConditionalEnhancerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/

namespace Symfony\Cmf\Component\Routing\Tests\Mapper;
namespace Symfony\Cmf\Component\Routing\Tests\Unit\Mapper;

use Symfony\Cmf\Component\Routing\Enhancer\ConditionalEnhancer;
use Symfony\Component\HttpFoundation\Request;
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Enhancer/ContentRepositoryEnhancerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/

namespace Symfony\Cmf\Component\Routing\Tests\Enhancer;
namespace Symfony\Cmf\Component\Routing\Tests\Unit\Enhancer;

use Symfony\Cmf\Component\Routing\Enhancer\ContentRepositoryEnhancer;
use Symfony\Cmf\Component\Routing\RouteObjectInterface;
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Enhancer/FieldByClassEnhancerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/

namespace Symfony\Cmf\Component\Routing\Tests\Enhancer;
namespace Symfony\Cmf\Component\Routing\Tests\Unit\Enhancer;

use Symfony\Component\HttpFoundation\Request;
use Symfony\Cmf\Component\Routing\Test\CmfUnitTestCase;
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Enhancer/FieldMapEnhancerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/

namespace Symfony\Cmf\Component\Routing\Tests\Mapper;
namespace Symfony\Cmf\Component\Routing\Tests\Unit\Mapper;

use Symfony\Component\HttpFoundation\Request;
use Symfony\Cmf\Component\Routing\Test\CmfUnitTestCase;
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Enhancer/FieldPresenceEnhancerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/

namespace Symfony\Cmf\Component\Routing\Tests\Enhancer;
namespace Symfony\Cmf\Component\Routing\Tests\Unit\Enhancer;

use Symfony\Component\HttpFoundation\Request;
use Symfony\Cmf\Component\Routing\Enhancer\FieldPresenceEnhancer;
Expand Down
4 changes: 2 additions & 2 deletions tests/Unit/Enhancer/RouteContentEnhancerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/

namespace Symfony\Cmf\Component\Routing\Tests\Enhancer;
namespace Symfony\Cmf\Component\Routing\Tests\Unit\Enhancer;

use Symfony\Component\HttpFoundation\Request;
use Symfony\Cmf\Component\Routing\Enhancer\RouteContentEnhancer;
Expand All @@ -27,7 +27,7 @@ class RouteContentEnhancerTest extends CmfUnitTestCase

public function setUp()
{
$this->document = $this->buildMock('Symfony\Cmf\Component\Routing\Tests\Enhancer\RouteObject',
$this->document = $this->buildMock('Symfony\Cmf\Component\Routing\Tests\Unit\Enhancer\RouteObject',
array('getContent', 'getRouteDefaults', 'getUrl'));

$this->mapper = new RouteContentEnhancer(RouteObjectInterface::ROUTE_OBJECT, '_content');
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Enhancer/RouteObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/

namespace Symfony\Cmf\Component\Routing\Tests\Enhancer;
namespace Symfony\Cmf\Component\Routing\Tests\Unit\Enhancer;

use Symfony\Component\Routing\Route;
use Symfony\Cmf\Component\Routing\RouteObjectInterface;
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/NestedMatcher/NestedMatcherTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/

namespace Symfony\Cmf\Component\Routing\Tests\NestedMatcher;
namespace Symfony\Cmf\Component\Routing\Tests\Unit\NestedMatcher;

use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\RouteCollection;
Expand Down
7 changes: 2 additions & 5 deletions tests/Unit/NestedMatcher/UrlMatcherTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/

namespace Symfony\Cmf\Component\Routing\Tests\NestedMatcher;
namespace Symfony\Cmf\Component\Routing\Tests\Unit\NestedMatcher;

use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\RouteCollection;
Expand All @@ -29,7 +29,7 @@ class UrlMatcherTest extends CmfUnitTestCase

public function setUp()
{
$this->routeDocument = $this->buildMock('Symfony\Cmf\Component\Routing\Tests\Routing\RouteMock', array('getDefaults', 'getRouteKey', 'compile'));
$this->routeDocument = $this->buildMock('Symfony\Cmf\Component\Routing\Tests\Unit\Routing\RouteMock', array('getDefaults', 'getRouteKey', 'compile'));
$this->routeCompiled = $this->buildMock('Symfony\Component\Routing\CompiledRoute');

$this->context = $this->buildMock('Symfony\Component\Routing\RequestContext');
Expand Down Expand Up @@ -112,9 +112,6 @@ public function testMatchNoRouteObject()
->method('compile')
->will($this->returnValue($this->routeCompiled))
;
$this->routeDocument->expects($this->never())
->method('getRouteKey')
;
$this->routeDocument->expects($this->atLeastOnce())
->method('getDefaults')
->will($this->returnValue(array('foo' => 'bar')))
Expand Down
4 changes: 0 additions & 4 deletions tests/Unit/Routing/ChainRouterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -698,10 +698,6 @@ public function testWarmup()
$dir = 'test_dir';
list($low) = $this->createRouterMocks();

$low
->expects($this->never())
->method('warmUp')
;
$high = $this->getMock('Symfony\Cmf\Component\Routing\Tests\Routing\WarmableRouterMock');
$high
->expects($this->once())
Expand Down
15 changes: 8 additions & 7 deletions tests/Unit/Routing/ContentAwareGeneratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use Symfony\Cmf\Component\Routing\RouteReferrersReadInterface;
use Symfony\Cmf\Component\Routing\ContentAwareGenerator;
use Symfony\Cmf\Component\Routing\Test\CmfUnitTestCase;
use Symfony\Cmf\Component\Routing\Tests\Unit\Routing\RouteMock;

class ContentAwareGeneratorTest extends CmfUnitTestCase
{
Expand All @@ -31,7 +32,7 @@ class ContentAwareGeneratorTest extends CmfUnitTestCase
public function setUp()
{
$this->contentDocument = $this->buildMock('Symfony\Cmf\Component\Routing\RouteReferrersReadInterface');
$this->routeDocument = $this->buildMock('Symfony\Cmf\Component\Routing\Tests\Routing\RouteMock', array('getDefaults', 'compile'));
$this->routeDocument = $this->buildMock(RouteMock::class, array('getDefaults', 'compile'));
$this->routeCompiled = $this->buildMock('Symfony\Component\Routing\CompiledRoute');
$this->provider = $this->buildMock('Symfony\Cmf\Component\Routing\RouteProviderInterface');
$this->context = $this->buildMock('Symfony\Component\Routing\RequestContext');
Expand Down Expand Up @@ -104,7 +105,7 @@ public function testGenerateEmptyRouteString()

public function testGenerateRouteMultilang()
{
$route_en = $this->buildMock('Symfony\Cmf\Component\Routing\Tests\Routing\RouteMock', array('getDefaults', 'compile', 'getContent'));
$route_en = $this->buildMock(RouteMock::class, array('getDefaults', 'compile', 'getContent'));
$route_en->setLocale('en');
$route_de = $this->routeDocument;
$route_de->setLocale('de');
Expand All @@ -130,7 +131,7 @@ public function testGenerateRouteMultilang()

public function testGenerateRouteMultilangDefaultLocale()
{
$route = $this->buildMock('Symfony\Cmf\Component\Routing\Tests\Routing\RouteMock');
$route = $this->buildMock(RouteMock::class);
$route->expects($this->any())
->method('compile')
->will($this->returnValue($this->routeCompiled))
Expand All @@ -155,7 +156,7 @@ public function testGenerateRouteMultilangDefaultLocale()

public function testGenerateRouteMultilangLocaleNomatch()
{
$route_en = $this->buildMock('Symfony\Cmf\Component\Routing\Tests\Routing\RouteMock', array('getDefaults', 'compile', 'getContent'));
$route_en = $this->buildMock(RouteMock::class, array('getDefaults', 'compile', 'getContent'));
$route_en->setLocale('en');
$route_de = $this->routeDocument;
$route_de->setLocale('de');
Expand Down Expand Up @@ -194,7 +195,7 @@ public function testGenerateNoncmfRouteMultilang()
public function testGenerateRoutenameMultilang()
{
$name = 'foo/bar';
$route_en = $this->buildMock('Symfony\Cmf\Component\Routing\Tests\Routing\RouteMock', array('getDefaults', 'compile', 'getContent'));
$route_en = $this->buildMock(RouteMock::class, array('getDefaults', 'compile', 'getContent'));
$route_en->setLocale('en');
$route_de = $this->routeDocument;
$route_de->setLocale('de');
Expand Down Expand Up @@ -241,7 +242,7 @@ public function testGenerateRoutenameMultilangNotFound()

public function testGenerateDocumentMultilang()
{
$route_en = $this->buildMock('Symfony\Cmf\Component\Routing\Tests\Routing\RouteMock', array('getDefaults', 'compile'));
$route_en = $this->buildMock(RouteMock::class, array('getDefaults', 'compile'));
$route_en->setLocale('en');
$route_de = $this->routeDocument;
$route_de->setLocale('de');
Expand All @@ -263,7 +264,7 @@ public function testGenerateDocumentMultilang()

public function testGenerateDocumentMultilangLocaleNomatch()
{
$route_en = $this->buildMock('Symfony\Cmf\Component\Routing\Tests\Routing\RouteMock', array('getDefaults', 'compile'));
$route_en = $this->buildMock(RouteMock::class, array('getDefaults', 'compile'));
$route_en->setLocale('en');
$route_de = $this->routeDocument;
$route_de->setLocale('de');
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Routing/DynamicRouterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class DynamicRouterTest extends CmfUnitTestCase

public function setUp()
{
$this->routeDocument = $this->buildMock('Symfony\Cmf\Component\Routing\Tests\Routing\RouteMock', array('getDefaults'));
$this->routeDocument = $this->buildMock('Symfony\Cmf\Component\Routing\Tests\Unit\Routing\RouteMock', array('getDefaults'));

$this->matcher = $this->buildMock('Symfony\Component\Routing\Matcher\UrlMatcherInterface');
$this->generator = $this->buildMock('Symfony\Cmf\Component\Routing\VersatileGeneratorInterface', array('supports', 'generate', 'setContext', 'getContext', 'getRouteDebugMessage'));
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Routing/RouteMock.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/

namespace Symfony\Cmf\Component\Routing\Tests\Routing;
namespace Symfony\Cmf\Component\Routing\Tests\Unit\Routing;

use Symfony\Component\Routing\Route as SymfonyRoute;
use Symfony\Cmf\Component\Routing\RouteObjectInterface;
Expand Down

0 comments on commit 0aa8838

Please sign in to comment.