actionManager = $this->container->get('plugin.manager.rules_action'); } /** * Utility function to bootstrap an action, run it, and do basic asserts. * * @return array * The event message, as an array. */ protected function assertExecution() { // Set the required contexts for the action to run. $this->action->setContextValue('entity', $this->entity); $this->action->setContextValue('user', $this->user); // Execute the action. $this->action->execute(); // Assert some basics. $message_str = $this->action->getProvidedContext('event_message')->getContextValue(); $this->assertNotEmpty($message_str, "Event message must not be empty."); $message = json_decode($message_str, TRUE); $this->assertTrue(array_key_exists('type', $message), "Event has type key."); // Return the event message. return $message; } }