Update to drupal 8.0.0-rc1. For more information, see https://www.drupal.org/node/2582663
This commit is contained in:
parent
eb34d130a8
commit
f32e58e4b1
8476 changed files with 211648 additions and 170042 deletions
71
vendor/symfony-cmf/routing/Tests/Enhancer/FieldByClassEnhancerTest.php
vendored
Normal file
71
vendor/symfony-cmf/routing/Tests/Enhancer/FieldByClassEnhancerTest.php
vendored
Normal file
|
@ -0,0 +1,71 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony CMF package.
|
||||
*
|
||||
* (c) 2011-2014 Symfony CMF
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Cmf\Component\Routing\Tests\Enhancer;
|
||||
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
use Symfony\Cmf\Component\Routing\Test\CmfUnitTestCase;
|
||||
use Symfony\Cmf\Component\Routing\Enhancer\FieldByClassEnhancer;
|
||||
|
||||
class FieldByClassEnhancerTest extends CmfUnitTestCase
|
||||
{
|
||||
private $request;
|
||||
/**
|
||||
* @var FieldByClassEnhancer
|
||||
*/
|
||||
private $mapper;
|
||||
private $document;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
$this->document = $this->buildMock('Symfony\Cmf\Component\Routing\Tests\Enhancer\RouteObject');
|
||||
|
||||
$mapping = array('Symfony\Cmf\Component\Routing\Tests\Enhancer\RouteObject'
|
||||
=> 'cmf_content.controller:indexAction');
|
||||
|
||||
$this->mapper = new FieldByClassEnhancer('_content', '_controller', $mapping);
|
||||
|
||||
$this->request = Request::create('/test');
|
||||
}
|
||||
|
||||
public function testClassFoundInMapping()
|
||||
{
|
||||
// this is the mock, thus a child class to make sure we properly check with instanceof
|
||||
$defaults = array('_content' => $this->document);
|
||||
$expected = array(
|
||||
'_content' => $this->document,
|
||||
'_controller' => 'cmf_content.controller:indexAction',
|
||||
);
|
||||
$this->assertEquals($expected, $this->mapper->enhance($defaults, $this->request));
|
||||
}
|
||||
|
||||
public function testFieldAlreadyThere()
|
||||
{
|
||||
$defaults = array(
|
||||
'_content' => $this->document,
|
||||
'_controller' => 'custom.controller:indexAction',
|
||||
);
|
||||
$this->assertEquals($defaults, $this->mapper->enhance($defaults, $this->request));
|
||||
}
|
||||
|
||||
public function testClassNotFoundInMapping()
|
||||
{
|
||||
$defaults = array('_content' => $this);
|
||||
$this->assertEquals($defaults, $this->mapper->enhance($defaults, $this->request));
|
||||
}
|
||||
|
||||
public function testNoClass()
|
||||
{
|
||||
$defaults = array('foo' => 'bar');
|
||||
$this->assertEquals($defaults, $this->mapper->enhance($defaults, $this->request));
|
||||
}
|
||||
}
|
69
vendor/symfony-cmf/routing/Tests/Enhancer/FieldMapEnhancerTest.php
vendored
Normal file
69
vendor/symfony-cmf/routing/Tests/Enhancer/FieldMapEnhancerTest.php
vendored
Normal file
|
@ -0,0 +1,69 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony CMF package.
|
||||
*
|
||||
* (c) 2011-2014 Symfony CMF
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Cmf\Component\Routing\Tests\Mapper;
|
||||
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
use Symfony\Cmf\Component\Routing\Test\CmfUnitTestCase;
|
||||
use Symfony\Cmf\Component\Routing\Enhancer\FieldMapEnhancer;
|
||||
|
||||
class FieldMapEnhancerTest extends CmfUnitTestCase
|
||||
{
|
||||
/**
|
||||
* @var Request
|
||||
*/
|
||||
private $request;
|
||||
|
||||
/**
|
||||
* @var FieldMapEnhancer
|
||||
*/
|
||||
private $enhancer;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
$this->request = Request::create('/test');
|
||||
$mapping = array('static_pages' => 'cmf_content.controller:indexAction');
|
||||
|
||||
$this->enhancer = new FieldMapEnhancer('type', '_controller', $mapping);
|
||||
}
|
||||
|
||||
public function testFieldFoundInMapping()
|
||||
{
|
||||
$defaults = array('type' => 'static_pages');
|
||||
$expected = array(
|
||||
'type' => 'static_pages',
|
||||
'_controller' => 'cmf_content.controller:indexAction',
|
||||
);
|
||||
$this->assertEquals($expected, $this->enhancer->enhance($defaults, $this->request));
|
||||
}
|
||||
|
||||
public function testFieldAlreadyThere()
|
||||
{
|
||||
$defaults = array(
|
||||
'type' => 'static_pages',
|
||||
'_controller' => 'custom.controller:indexAction',
|
||||
);
|
||||
$this->assertEquals($defaults, $this->enhancer->enhance($defaults, $this->request));
|
||||
}
|
||||
|
||||
public function testNoType()
|
||||
{
|
||||
$defaults = array();
|
||||
$this->assertEquals(array(), $this->enhancer->enhance($defaults, $this->request));
|
||||
}
|
||||
|
||||
public function testNotFoundInMapping()
|
||||
{
|
||||
$defaults = array('type' => 'unknown_route');
|
||||
$this->assertEquals($defaults, $this->enhancer->enhance($defaults, $this->request));
|
||||
}
|
||||
}
|
71
vendor/symfony-cmf/routing/Tests/Enhancer/FieldPresenceEnhancerTest.php
vendored
Normal file
71
vendor/symfony-cmf/routing/Tests/Enhancer/FieldPresenceEnhancerTest.php
vendored
Normal file
|
@ -0,0 +1,71 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony CMF package.
|
||||
*
|
||||
* (c) 2011-2014 Symfony CMF
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Cmf\Component\Routing\Tests\Enhancer;
|
||||
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
use Symfony\Cmf\Component\Routing\Enhancer\FieldPresenceEnhancer;
|
||||
|
||||
use Symfony\Cmf\Component\Routing\Test\CmfUnitTestCase;
|
||||
|
||||
class FieldPresenceEnhancerTest extends CmfUnitTestCase
|
||||
{
|
||||
/**
|
||||
* @var FieldPresenceEnhancer
|
||||
*/
|
||||
private $mapper;
|
||||
private $request;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
$this->mapper = new FieldPresenceEnhancer('_template', '_controller', 'cmf_content.controller:indexAction');
|
||||
|
||||
$this->request = Request::create('/test');
|
||||
}
|
||||
|
||||
public function testHasTemplate()
|
||||
{
|
||||
$defaults = array('_template' => 'Bundle:Topic:template.html.twig');
|
||||
$expected = array(
|
||||
'_template' => 'Bundle:Topic:template.html.twig',
|
||||
'_controller' => 'cmf_content.controller:indexAction',
|
||||
);
|
||||
$this->assertEquals($expected, $this->mapper->enhance($defaults, $this->request));
|
||||
}
|
||||
|
||||
public function testFieldAlreadyThere()
|
||||
{
|
||||
$defaults = array(
|
||||
'_template' => 'Bundle:Topic:template.html.twig',
|
||||
'_controller' => 'custom.controller:indexAction',
|
||||
);
|
||||
$this->assertEquals($defaults, $this->mapper->enhance($defaults, $this->request));
|
||||
}
|
||||
|
||||
public function testHasNoSourceValue()
|
||||
{
|
||||
$defaults = array('foo' => 'bar');
|
||||
$this->assertEquals($defaults, $this->mapper->enhance($defaults, $this->request));
|
||||
}
|
||||
|
||||
public function testHasNoSource()
|
||||
{
|
||||
$this->mapper = new FieldPresenceEnhancer(null, '_controller', 'cmf_content.controller:indexAction');
|
||||
|
||||
$defaults = array('foo' => 'bar');
|
||||
$expected = array(
|
||||
'foo' => 'bar',
|
||||
'_controller' => 'cmf_content.controller:indexAction',
|
||||
);
|
||||
$this->assertEquals($expected, $this->mapper->enhance($defaults, $this->request));
|
||||
}
|
||||
}
|
87
vendor/symfony-cmf/routing/Tests/Enhancer/RouteContentEnhancerTest.php
vendored
Normal file
87
vendor/symfony-cmf/routing/Tests/Enhancer/RouteContentEnhancerTest.php
vendored
Normal file
|
@ -0,0 +1,87 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony CMF package.
|
||||
*
|
||||
* (c) 2011-2014 Symfony CMF
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Cmf\Component\Routing\Tests\Enhancer;
|
||||
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
use Symfony\Cmf\Component\Routing\Enhancer\RouteContentEnhancer;
|
||||
use Symfony\Cmf\Component\Routing\RouteObjectInterface;
|
||||
|
||||
use Symfony\Cmf\Component\Routing\Test\CmfUnitTestCase;
|
||||
|
||||
class RouteContentEnhancerTest extends CmfUnitTestCase
|
||||
{
|
||||
/**
|
||||
* @var RouteContentEnhancer
|
||||
*/
|
||||
private $mapper;
|
||||
private $document;
|
||||
private $request;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
$this->document = $this->buildMock('Symfony\Cmf\Component\Routing\Tests\Enhancer\RouteObject',
|
||||
array('getContent', 'getRouteDefaults', 'getUrl'));
|
||||
|
||||
$this->mapper = new RouteContentEnhancer(RouteObjectInterface::ROUTE_OBJECT, '_content');
|
||||
|
||||
$this->request = Request::create('/test');
|
||||
}
|
||||
|
||||
public function testContent()
|
||||
{
|
||||
$targetDocument = new TargetDocument();
|
||||
$this->document->expects($this->once())
|
||||
->method('getContent')
|
||||
->will($this->returnValue($targetDocument));
|
||||
|
||||
$defaults = array(RouteObjectInterface::ROUTE_OBJECT => $this->document);
|
||||
$expected = array(RouteObjectInterface::ROUTE_OBJECT => $this->document, '_content' => $targetDocument);
|
||||
|
||||
$this->assertEquals($expected, $this->mapper->enhance($defaults, $this->request));
|
||||
}
|
||||
|
||||
public function testFieldAlreadyThere()
|
||||
{
|
||||
$this->document->expects($this->never())
|
||||
->method('getContent')
|
||||
;
|
||||
|
||||
$defaults = array(RouteObjectInterface::ROUTE_OBJECT => $this->document, '_content' => 'foo');
|
||||
|
||||
$this->assertEquals($defaults, $this->mapper->enhance($defaults, $this->request));
|
||||
}
|
||||
|
||||
public function testNoContent()
|
||||
{
|
||||
$this->document->expects($this->once())
|
||||
->method('getContent')
|
||||
->will($this->returnValue(null));
|
||||
|
||||
$defaults = array(RouteObjectInterface::ROUTE_OBJECT => $this->document);
|
||||
$this->assertEquals($defaults, $this->mapper->enhance($defaults, $this->request));
|
||||
}
|
||||
|
||||
public function testNoCmfRoute()
|
||||
{
|
||||
$defaults = array(RouteObjectInterface::ROUTE_OBJECT => $this->buildMock('Symfony\Component\Routing\Route'));
|
||||
$this->assertEquals($defaults, $this->mapper->enhance($defaults, $this->request));
|
||||
}
|
||||
}
|
||||
|
||||
class TargetDocument
|
||||
{
|
||||
}
|
||||
|
||||
class UnknownDocument
|
||||
{
|
||||
}
|
27
vendor/symfony-cmf/routing/Tests/Enhancer/RouteObject.php
vendored
Normal file
27
vendor/symfony-cmf/routing/Tests/Enhancer/RouteObject.php
vendored
Normal file
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony CMF package.
|
||||
*
|
||||
* (c) 2011-2014 Symfony CMF
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Cmf\Component\Routing\Tests\Enhancer;
|
||||
|
||||
use Symfony\Component\Routing\Route;
|
||||
use Symfony\Cmf\Component\Routing\RouteObjectInterface;
|
||||
|
||||
/**
|
||||
* Empty abstract class to be able to mock an object that both extends Route
|
||||
* and implements RouteObjectInterface
|
||||
*/
|
||||
abstract class RouteObject extends Route implements RouteObjectInterface
|
||||
{
|
||||
public function getRouteKey()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
Reference in a new issue