Commit 8019e559 authored by webchick's avatar webchick

Issue #1848072 by katbailey, sun: Fixed Path alias manager hardcodes...

Issue #1848072 by katbailey, sun: Fixed Path alias manager hardcodes keyvalue.database instead of using the generic factory.
parent a99bd728
......@@ -2487,7 +2487,7 @@ function drupal_container(Container $new_container = NULL, $rebuild = FALSE) {
$container->register('path.alias_manager', 'Drupal\Core\Path\AliasManager')
->addArgument(new Reference('database'))
->addArgument(new Reference('keyvalue.database'));
->addArgument(new Reference('keyvalue'));
// Register the EntityManager.
$container->register('plugin.manager.entity', 'Drupal\Core\Entity\EntityManager');
......
......@@ -77,7 +77,7 @@ public function build(ContainerBuilder $container) {
$container->register('path.alias_manager', 'Drupal\Core\Path\AliasManager')
->addArgument(new Reference('database'))
->addArgument(new Reference('keyvalue.database'));
->addArgument(new Reference('keyvalue'));
// Register the EntityManager.
$container->register('plugin.manager.entity', 'Drupal\Core\Entity\EntityManager');
......
......@@ -8,7 +8,7 @@
namespace Drupal\Core\Path;
use Drupal\Core\Database\Connection;
use Drupal\Core\KeyValueStore\KeyValueDatabaseFactory;
use Drupal\Core\KeyValueStore\KeyValueFactory;
class AliasManager implements AliasManagerInterface {
......@@ -78,7 +78,7 @@ class AliasManager implements AliasManagerInterface {
*/
protected $preloadedPathLookups = array();
public function __construct(Connection $connection, KeyValueDatabaseFactory $keyvalue) {
public function __construct(Connection $connection, KeyValueFactory $keyvalue) {
$this->connection = $connection;
$this->state = $keyvalue->get('state');
$this->langcode = language(LANGUAGE_TYPE_URL)->langcode;
......
......@@ -7,16 +7,15 @@
namespace Drupal\system\Tests\Path;
use Drupal\simpletest\UnitTestBase;
use Drupal\simpletest\DrupalUnitTestBase;
use Drupal\Core\Database\Database;
use Drupal\Core\KeyValueStore\KeyValueDatabaseFactory;
use Drupal\Core\Path\Path;
use Drupal\Core\Path\AliasManager;
/**
* Tests path alias CRUD and lookup functionality.
*/
class AliasTest extends UnitTestBase {
class AliasTest extends DrupalUnitTestBase {
public static function getInfo() {
return array(
......@@ -26,9 +25,8 @@ public static function getInfo() {
);
}
function __construct($test_id = NULL) {
parent::__construct($test_id);
public function setUp() {
parent::setUp();
$this->fixtures = new UrlAliasFixtures();
}
......@@ -45,7 +43,7 @@ function testCRUD() {
$this->fixtures->createTables($connection);
//Create AliasManager and Path object.
$aliasManager = new AliasManager($connection, new KeyValueDatabaseFactory($connection));
$aliasManager = new AliasManager($connection, $this->container->get('keyvalue'));
$path = new Path($connection, $aliasManager);
$aliases = $this->fixtures->sampleUrlAliases();
......@@ -98,7 +96,7 @@ function testLookupPath() {
$this->fixtures->createTables($connection);
//Create AliasManager and Path object.
$aliasManager = new AliasManager($connection, new KeyValueDatabaseFactory($connection));
$aliasManager = new AliasManager($connection, $this->container->get('keyvalue'));
$pathObject = new Path($connection, $aliasManager);
// Test the situation where the source is the same for multiple aliases.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment