class NodeBulkFormTest in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/node/tests/src/Unit/Plugin/views/field/NodeBulkFormTest.php \Drupal\Tests\node\Unit\Plugin\views\field\NodeBulkFormTest
@coversDefaultClass \Drupal\node\Plugin\views\field\NodeBulkForm @group node
Hierarchy
- class \Drupal\Tests\UnitTestCase extends \Drupal\Tests\PHPUnit_Framework_TestCase
- class \Drupal\Tests\node\Unit\Plugin\views\field\NodeBulkFormTest
Expanded class hierarchy of NodeBulkFormTest
File
- core/
modules/ node/ tests/ src/ Unit/ Plugin/ views/ field/ NodeBulkFormTest.php, line 18 - Contains \Drupal\Tests\node\Unit\Plugin\views\field\NodeBulkFormTest.
Namespace
Drupal\Tests\node\Unit\Plugin\views\fieldView source
class NodeBulkFormTest extends UnitTestCase {
/**
* {@inheritdoc}
*/
protected function tearDown() {
parent::tearDown();
$container = new ContainerBuilder();
\Drupal::setContainer($container);
}
/**
* Tests the constructor assignment of actions.
*/
public function testConstructor() {
$actions = array();
for ($i = 1; $i <= 2; $i++) {
$action = $this
->getMock('\\Drupal\\system\\ActionConfigEntityInterface');
$action
->expects($this
->any())
->method('getType')
->will($this
->returnValue('node'));
$actions[$i] = $action;
}
$action = $this
->getMock('\\Drupal\\system\\ActionConfigEntityInterface');
$action
->expects($this
->any())
->method('getType')
->will($this
->returnValue('user'));
$actions[] = $action;
$entity_storage = $this
->getMock('Drupal\\Core\\Entity\\EntityStorageInterface');
$entity_storage
->expects($this
->any())
->method('loadMultiple')
->will($this
->returnValue($actions));
$entity_manager = $this
->getMock('Drupal\\Core\\Entity\\EntityManagerInterface');
$entity_manager
->expects($this
->once())
->method('getStorage')
->with('action')
->will($this
->returnValue($entity_storage));
$language_manager = $this
->getMock('Drupal\\Core\\Language\\LanguageManagerInterface');
$views_data = $this
->getMockBuilder('Drupal\\views\\ViewsData')
->disableOriginalConstructor()
->getMock();
$views_data
->expects($this
->any())
->method('get')
->with('node')
->will($this
->returnValue(array(
'table' => array(
'entity type' => 'node',
),
)));
$container = new ContainerBuilder();
$container
->set('views.views_data', $views_data);
$container
->set('string_translation', $this
->getStringTranslationStub());
\Drupal::setContainer($container);
$storage = $this
->getMock('Drupal\\views\\ViewEntityInterface');
$storage
->expects($this
->any())
->method('get')
->with('base_table')
->will($this
->returnValue('node'));
$executable = $this
->getMockBuilder('Drupal\\views\\ViewExecutable')
->disableOriginalConstructor()
->getMock();
$executable->storage = $storage;
$display = $this
->getMockBuilder('Drupal\\views\\Plugin\\views\\display\\DisplayPluginBase')
->disableOriginalConstructor()
->getMock();
$definition['title'] = '';
$options = array();
$node_bulk_form = new NodeBulkForm(array(), 'node_bulk_form', $definition, $entity_manager, $language_manager);
$node_bulk_form
->init($executable, $display, $options);
$this
->assertAttributeEquals(array_slice($actions, 0, -1, TRUE), 'actions', $node_bulk_form);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
NodeBulkFormTest:: |
protected | function | ||
NodeBulkFormTest:: |
public | function | Tests the constructor assignment of actions. | |
UnitTestCase:: |
protected | property | The random generator. | |
UnitTestCase:: |
protected | property | The app root. | |
UnitTestCase:: |
protected | function | Asserts if two arrays are equal by sorting them first. | |
UnitTestCase:: |
protected | function | Mocks a block with a block plugin. | |
UnitTestCase:: |
protected | function | Returns a stub class resolver. | |
UnitTestCase:: |
public | function | Returns a stub config factory that behaves according to the passed in array. | |
UnitTestCase:: |
public | function | Returns a stub config storage that returns the supplied configuration. | |
UnitTestCase:: |
protected | function | Sets up a container with a cache tags invalidator. | |
UnitTestCase:: |
protected | function | Gets the random generator for the utility methods. | |
UnitTestCase:: |
public | function | Returns a stub translation manager that just returns the passed string. | |
UnitTestCase:: |
public | function | Generates a unique random string containing letters and numbers. | |
UnitTestCase:: |
protected | function | 259 |