class ViewsBulkEditActionTest in Views Bulk Edit 8.2
Same name in this branch
- 8.2 tests/src/Functional/ViewsBulkEditActionTest.php \Drupal\Tests\views_bulk_edit\Functional\ViewsBulkEditActionTest
- 8.2 tests/src/Kernel/ViewsBulkEditActionTest.php \Drupal\Tests\views_bulk_edit\Kernel\ViewsBulkEditActionTest
@coversDefaultClass \Drupal\views_bulk_edit\Plugin\Action\ModifyEntityValues @group views_bulk_edit
Hierarchy
- class \Drupal\Tests\views_bulk_edit\Kernel\ViewsBulkEditActionTest extends \Drupal\Tests\views_bulk_operations\Kernel\ViewsBulkOperationsKernelTestBase
Expanded class hierarchy of ViewsBulkEditActionTest
File
- tests/
src/ Kernel/ ViewsBulkEditActionTest.php, line 12
Namespace
Drupal\Tests\views_bulk_edit\KernelView source
class ViewsBulkEditActionTest extends ViewsBulkOperationsKernelTestBase {
/**
* {@inheritdoc}
*/
public static $modules = [
'views_bulk_edit',
];
/**
* {@inheritdoc}
*/
public function setUp() {
parent::setUp();
$this
->createTestNodes([
'page' => [
'count' => 10,
],
]);
}
/**
* Tests the bulk edit action.
*
* @covers ::getViewBundles
* @covers ::execute
*/
public function testModifyEntityValues() {
$vbo_data = [
'view_id' => 'views_bulk_operations_test',
'action_id' => 'views_bulk_edit',
'configuration' => [
'node' => [
'page' => [
'values' => [
'status' => [
[
'value' => 0,
],
],
],
'change_method' => [
'status' => 'replace',
],
],
],
],
];
// Get list of rows to process from different view pages.
$selection = [
0,
3,
6,
8,
];
$vbo_data['list'] = $this
->getResultsList($vbo_data, $selection);
// Execute the action.
$results = $this
->executeAction($vbo_data);
$nodeStorage = $this->container
->get('entity_type.manager')
->getStorage('node');
$statuses = [];
foreach ($this->testNodesData as $id => $lang_data) {
$node = $nodeStorage
->load($id);
$status = intval($node->status->value);
foreach ($vbo_data['list'] as $item) {
if ($item[3] == $id) {
$this
->assertEquals(NodeInterface::NOT_PUBLISHED, $status);
break 2;
}
}
$this
->assertEquals(NodeInterface::PUBLISHED, $status);
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ViewsBulkEditActionTest:: |
public static | property | ||
ViewsBulkEditActionTest:: |
public | function | ||
ViewsBulkEditActionTest:: |
public | function | Tests the bulk edit action. |