class UserBulkFormTest
Same name and namespace in other branches
- 11.x core/modules/user/tests/src/Unit/Plugin/views/field/UserBulkFormTest.php \Drupal\Tests\user\Unit\Plugin\views\field\UserBulkFormTest
- 10 core/modules/user/tests/src/Unit/Plugin/views/field/UserBulkFormTest.php \Drupal\Tests\user\Unit\Plugin\views\field\UserBulkFormTest
- 9 core/modules/user/tests/src/Unit/Plugin/views/field/UserBulkFormTest.php \Drupal\Tests\user\Unit\Plugin\views\field\UserBulkFormTest
- 8.9.x core/modules/user/tests/src/Unit/Plugin/views/field/UserBulkFormTest.php \Drupal\Tests\user\Unit\Plugin\views\field\UserBulkFormTest
Tests Drupal\user\Plugin\views\field\UserBulkForm.
Attributes
#[CoversClass(UserBulkForm::class)]
#[Group('user')]
Hierarchy
- class \Drupal\Tests\UnitTestCase uses \Drupal\Tests\DrupalTestCaseTrait, \Drupal\Tests\PhpUnitCompatibilityTrait, \Prophecy\PhpUnit\ProphecyTrait, \Drupal\TestTools\Extension\DeprecationBridge\ExpectDeprecationTrait, \Drupal\Tests\RandomGeneratorTrait extends \PHPUnit\Framework\TestCase
- class \Drupal\Tests\user\Unit\Plugin\views\field\UserBulkFormTest extends \Drupal\Tests\UnitTestCase
Expanded class hierarchy of UserBulkFormTest
File
-
core/
modules/ user/ tests/ src/ Unit/ Plugin/ views/ field/ UserBulkFormTest.php, line 27
Namespace
Drupal\Tests\user\Unit\Plugin\views\fieldView source
class UserBulkFormTest extends UnitTestCase {
/**
* {@inheritdoc}
*/
protected function tearDown() : void {
parent::tearDown();
$container = new ContainerBuilder();
\Drupal::setContainer($container);
}
/**
* Tests the constructor assignment of actions.
*/
public function testConstructor() : void {
$actions = [];
for ($i = 1; $i <= 2; $i++) {
$action = $this->createStub(ActionConfigEntityInterface::class);
$action->method('getType')
->willReturn('user');
$actions[$i] = $action;
}
$action = $this->createStub(ActionConfigEntityInterface::class);
$action->method('getType')
->willReturn('node');
$actions[] = $action;
$entity_storage = $this->createStub(EntityStorageInterface::class);
$entity_storage->method('loadMultiple')
->willReturn($actions);
$entity_type_manager = $this->createStub(EntityTypeManagerInterface::class);
$entity_type_manager->method('getStorage')
->with('action')
->willReturn($entity_storage);
$entity_repository = $this->createStub(EntityRepositoryInterface::class);
$language_manager = $this->createStub(LanguageManagerInterface::class);
$messenger = $this->createStub(MessengerInterface::class);
$route_match = $this->createStub(ResettableStackedRouteMatchInterface::class);
$views_data = $this->createStub(ViewsData::class);
$views_data->method('get')
->with('users')
->willReturn([
'table' => [
'entity type' => 'user',
],
]);
$container = new ContainerBuilder();
$container->set('views.views_data', $views_data);
$container->set('string_translation', $this->getStringTranslationStub());
\Drupal::setContainer($container);
$storage = $this->createStub(ViewEntityInterface::class);
$storage->method('get')
->with('base_table')
->willReturn('users');
$executable = $this->createStub(ViewExecutable::class);
$executable->storage = $storage;
$display = $this->createStub(DisplayPluginBase::class);
$definition['title'] = '';
$options = [];
$user_bulk_form = new UserBulkForm([], 'user_bulk_form', $definition, $entity_type_manager, $language_manager, $messenger, $entity_repository, $route_match);
$user_bulk_form->init($executable, $display, $options);
$reflected_actions = (new \ReflectionObject($user_bulk_form))->getProperty('actions');
$this->assertEquals(array_slice($actions, 0, -1, TRUE), $reflected_actions->getValue($user_bulk_form));
}
}
Members
| Title Sort descending | Deprecated | Modifiers | Object type | Summary | Overrides |
|---|---|---|---|---|---|
| DrupalTestCaseTrait::checkErrorHandlerOnTearDown | public | function | Checks the test error handler after test execution. | ||
| ExpectDeprecationTrait::expectDeprecation | Deprecated | public | function | Adds an expected deprecation. | |
| ExpectDeprecationTrait::regularExpressionForFormatDescription | private | function | |||
| RandomGeneratorTrait::getRandomGenerator | protected | function | Gets the random generator for the utility methods. | ||
| RandomGeneratorTrait::randomMachineName | protected | function | Generates a unique random string containing letters and numbers. | ||
| RandomGeneratorTrait::randomObject | public | function | Generates a random PHP object. | ||
| RandomGeneratorTrait::randomString | public | function | Generates a pseudo-random string of ASCII characters of codes 32 to 126. | ||
| UnitTestCase::$root | protected | property | The app root. | ||
| UnitTestCase::getClassResolverStub | protected | function | Returns a stub class resolver. | ||
| UnitTestCase::getConfigFactoryStub | public | function | Returns a stub config factory that behaves according to the passed array. | ||
| UnitTestCase::getContainerWithCacheTagsInvalidator | protected | function | Sets up a container with a cache tags invalidator. | ||
| UnitTestCase::getStringTranslationStub | public | function | Returns a stub translation manager that just returns the passed string. | ||
| UnitTestCase::setDebugDumpHandler | public static | function | Registers the dumper CLI handler when the DebugDump extension is enabled. | ||
| UnitTestCase::setUp | protected | function | 366 | ||
| UnitTestCase::setupMockIterator | protected | function | Set up a traversable class mock to return specific items when iterated. | ||
| UserBulkFormTest::tearDown | protected | function | |||
| UserBulkFormTest::testConstructor | public | function | Tests the constructor assignment of actions. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.