protected function VoteUpDownWidgetManagerTest::setUp in Vote Up/Down 8
Overrides UnitTestCase::setUp
File
- tests/
src/ Unit/ VoteUpDownWidgetManagerTest.php, line 28
Class
- VoteUpDownWidgetManagerTest
- A Unit test to check if the plugins are working fine.
Namespace
Drupal\Tests\vud\UnitCode
protected function setUp() {
parent::setUp();
$cache_backend = $this
->prophesize(CacheBackendInterface::class);
$module_handler = $this
->prophesize(ModuleHandlerInterface::class);
$this->voteUpDownWidgetManager = new VoteUpDownWidgetManager(new \ArrayObject(), $cache_backend
->reveal(), $module_handler
->reveal());
$discovery = $this
->prophesize(DiscoveryInterface::class);
$discovery
->getDefinitions()
->willReturn([
'newPlugin' => [
'id' => 'new_plugin',
'admin_label' => @t('New Plugin'),
'description' => 'New plugin type',
],
]);
$property = new \ReflectionProperty(VoteUpDownWidgetManager::class, 'discovery');
$property
->setAccessible(TRUE);
$property
->setValue($this->voteUpDownWidgetManager, $discovery
->reveal());
}