Commit 423f1d65 authored by catch's avatar catch
Browse files

Issue #2020979 by dawehner, bojanz: Fixed Bulk action form no longer allows actions to be selected.

parent fca30517
......@@ -7,8 +7,8 @@
namespace Drupal\node\Plugin\views\field;
use Drupal\views\Plugin\views\field\ActionBulkForm;
use Drupal\Component\Annotation\PluginID;
use Drupal\system\Plugin\views\field\BulkFormBase;
use Drupal\Core\Cache\Cache;
use Drupal\Core\Entity\EntityManager;
......@@ -17,7 +17,7 @@
*
* @PluginID("node_bulk_form")
*/
class NodeBulkForm extends BulkFormBase {
class NodeBulkForm extends ActionBulkForm {
/**
* Constructs a new NodeBulkForm object.
......
......@@ -25,7 +25,7 @@ public static function getInfo() {
return array(
'name' => 'Node: Bulk form',
'description' => 'Tests a node bulk form.',
'group' => 'Views Modules',
'group' => 'Views module integration',
);
}
......
<?php
/**
* @file
* Contains \Drupal\node\Tests\Plugin\views\field\NodeBulkFormTest.
*/
namespace Drupal\node\Tests\Plugin\views\field;
use Drupal\node\Plugin\views\field\NodeBulkForm;
use Drupal\Tests\UnitTestCase;
/**
* Tests the node bulk form plugin.
*
* @see \Drupal\node\Plugin\views\field\NodeBulkForm
*/
class NodeBulkFormTest extends UnitTestCase {
public static function getInfo() {
return array(
'name' => 'Node: Bulk form',
'description' => 'Tests the node bulk form plugin.',
'group' => 'Views module integration',
);
}
/**
* Tests the constructor assignment of actions.
*/
public function testConstructor() {
$actions = array();
for ($i = 1; $i <= 2; $i++) {
$action = $this->getMockBuilder('Drupal\system\Plugin\Core\Entity\Action')
->disableOriginalConstructor()
->getMock();
$action->expects($this->any())
->method('getType')
->will($this->returnValue('node'));
$actions[$i] = $action;
}
$action = $this->getMockBuilder('Drupal\system\Plugin\Core\Entity\Action')
->disableOriginalConstructor()
->getMock();
$action->expects($this->any())
->method('getType')
->will($this->returnValue('user'));
$actions[] = $action;
$entity_manager = $this->getMockBuilder('Drupal\Core\Entity\EntityManager')
->disableOriginalConstructor()
->getMock();
$storage_controller = $this->getMock('Drupal\Core\Entity\EntityStorageControllerInterface');
$storage_controller->expects($this->any())
->method('loadMultiple')
->will($this->returnValue($actions));
$entity_manager->expects($this->any())
->method('getStorageController')
->with('action')
->will($this->returnValue($storage_controller));
$node_bulk_form = new NodeBulkForm(array(), 'node_bulk_form', array(), $entity_manager);
$this->assertAttributeEquals(array_slice($actions, 0, -1, TRUE), 'actions', $node_bulk_form);
}
}
......@@ -7,9 +7,9 @@
namespace Drupal\user\Plugin\views\field;
use Drupal\views\Plugin\views\field\ActionBulkForm;
use Drupal\Component\Annotation\PluginID;
use Drupal\Core\Entity\EntityManager;
use Drupal\system\Plugin\views\field\BulkFormBase;
use Drupal\user\UserInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
......@@ -18,7 +18,7 @@
*
* @PluginID("user_bulk_form")
*/
class UserBulkForm extends BulkFormBase {
class UserBulkForm extends ActionBulkForm {
/**
* {@inheritdoc}
......
<?php
/**
* @file
* Contains \Drupal\user\Tests\Plugin\views\field\UserBulkFormTest.
*/
namespace Drupal\user\Tests\Plugin\views\field;
use Drupal\Tests\UnitTestCase;
use Drupal\user\Plugin\views\field\UserBulkForm;
/**
* Tests the user bulk form plugin.
*
* @see \Drupal\user\Plugin\views\field\UserBulkForm
*/
class UserBulkFormTest extends UnitTestCase {
public static function getInfo() {
return array(
'name' => 'User: Bulk form',
'description' => 'Tests the user bulk form plugin.',
'group' => 'Views module integration',
);
}
/**
* Tests the constructor assignment of actions.
*/
public function testConstructor() {
$actions = array();
for ($i = 1; $i <= 2; $i++) {
$action = $this->getMockBuilder('Drupal\system\Plugin\Core\Entity\Action')
->disableOriginalConstructor()
->getMock();
$action->expects($this->any())
->method('getType')
->will($this->returnValue('user'));
$actions[$i] = $action;
}
$action = $this->getMockBuilder('Drupal\system\Plugin\Core\Entity\Action')
->disableOriginalConstructor()
->getMock();
$action->expects($this->any())
->method('getType')
->will($this->returnValue('node'));
$actions[] = $action;
$entity_manager = $this->getMockBuilder('Drupal\Core\Entity\EntityManager')
->disableOriginalConstructor()
->getMock();
$storage_controller = $this->getMock('Drupal\Core\Entity\EntityStorageControllerInterface');
$storage_controller->expects($this->any())
->method('loadMultiple')
->will($this->returnValue($actions));
$entity_manager->expects($this->any())
->method('getStorageController')
->with('action')
->will($this->returnValue($storage_controller));
$user_bulk_form = new UserBulkForm(array(), 'user_bulk_form', array(), $entity_manager);
$this->assertAttributeEquals(array_slice($actions, 0, -1, TRUE), 'actions', $user_bulk_form);
}
}
......@@ -2,10 +2,10 @@
/**
* @file
* Contains \Drupal\action\Plugin\views\field\BulkForm.
* Contains \Drupal\views\Plugin\views\field\BulkForm.
*/
namespace Drupal\action\Plugin\views\field;
namespace Drupal\views\Plugin\views\field;
use Drupal\Component\Annotation\PluginID;
use Drupal\system\Plugin\views\field\BulkFormBase;
......@@ -15,7 +15,7 @@
*
* @PluginID("action_bulk_form")
*/
class BulkForm extends BulkFormBase {
class ActionBulkForm extends BulkFormBase {
/**
* Overrides \Drupal\views\Plugin\views\field\FieldPluginBase::defineOptions().
......
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