public function TermSelectionTest::setUp in Taxonomy container 8
Overrides UnitTestCase::setUp
File
- tests/
src/ Unit/ TermSelectionTest.php, line 80
Class
- TermSelectionTest
- Tests selection of taxonomy terms by the Taxonomy Container module.
Namespace
Drupal\Tests\taxonomy_container\UnitCode
public function setUp() {
parent::setUp();
// Define basic settings for the plugin.
$this->configuration = [
'handler_settings' => [],
];
// Provide mocks for the dependencies.
$this->entityTypeManager = $this
->prophesize(EntityTypeManagerInterface::class);
$this->termStorage = $this
->prophesize(TermStorageInterface::class);
$this->entityTypeManager
->getStorage('taxonomy_term')
->willReturn($this->termStorage
->reveal());
$this->moduleHandler = $this
->prophesize(ModuleHandlerInterface::class);
$this->user = $this
->prophesize(AccountInterface::class);
$this->entityFieldManager = $this
->prophesize(EntityFieldManagerInterface::class);
$this->entityTypeBundleInfo = $this
->prophesize(EntityTypeBundleInfoInterface::class);
$this->entityRepository = $this
->prophesize(EntityRepositoryInterface::class);
$this->entityRepository
->getTranslationFromContext(Argument::type(TermInterface::class))
->will(function ($args) {
return $args[0];
});
}