diff --git a/src/Tests/FlagEventsTest.php b/src/Tests/FlagEventsTest.php deleted file mode 100644 index 3a355cd..0000000 --- a/src/Tests/FlagEventsTest.php +++ /dev/null @@ -1,65 +0,0 @@ -prophesize(FlagInterface::class); - $flag->getFlaggableEntityTypeId()->willReturn('test'); - $flag->label()->willReturn('Cheesy'); - - // Mock a FlagServiceInterface and inject it into the container. - $this->flagService = $this->prophesize(FlagServiceInterface::class); - $this->flagService->getFlags()->willReturn([$flag]); - $this->container->set('flag', $this->flagService->reveal()); - - $this->enabledModules['flag'] = TRUE; - $this->moduleHandler->getModuleDirectories() - ->willReturn(['flag' => __DIR__ . '/../..']); - $this->eventManager = new RulesEventManager($this->moduleHandler->reveal()); - } - - /** - * Test the event metadata is generated. - */ - public function testEventMetadata() { - $plugin_definition = $this->eventManager->getDefinition('flag.entity_flagged:test'); - $this->assertSame('A test has been flagged, under "Cheesy"', (string) $plugin_definition['label']); - $context_definition = $plugin_definition['context']['entity']; - $this->assertSame('entity:test', $context_definition->getDataType()); - $this->assertSame('Flagged Entity', $context_definition->getLabel()); - } - -} diff --git a/tests/src/Integration/Event/FlagEventsTest.php b/tests/src/Integration/Event/FlagEventsTest.php new file mode 100644 index 0000000..63df269 --- /dev/null +++ b/tests/src/Integration/Event/FlagEventsTest.php @@ -0,0 +1,65 @@ +prophesize(FlagInterface::class); + $flag->getFlaggableEntityTypeId()->willReturn('test'); + $flag->label()->willReturn('Cheesy'); + + // Mock a FlagServiceInterface and inject it into the container. + $this->flagService = $this->prophesize(FlagServiceInterface::class); + $this->flagService->getFlags()->willReturn([$flag]); + $this->container->set('flag', $this->flagService->reveal()); + + $this->enabledModules['flag'] = TRUE; + $this->moduleHandler->getModuleDirectories() + ->willReturn(['flag' => __DIR__ . '/../../../../../flag']); + $this->eventManager = new RulesEventManager($this->moduleHandler->reveal()); + } + + /** + * Test the event metadata is generated. + */ + public function testEventMetadata() { + $plugin_definition = $this->eventManager->getDefinition('flag.entity_flagged:test'); + $this->assertSame('A test has been flagged, under "Cheesy"', (string) $plugin_definition['label']); + $context_definition = $plugin_definition['context']['entity']; + $this->assertSame('entity:test', $context_definition->getDataType()); + $this->assertSame('Flagged Entity', $context_definition->getLabel()); + } + +}