public function RngMessageRules::testRngRegistrationCreateMessages in RNG - Events and Registrations 3.x
Same name and namespace in other branches
- 8.2 tests/src/Kernel/RngMessageRules.php \Drupal\Tests\rng\Kernel\RngMessageRules::testRngRegistrationCreateMessages()
- 8 tests/src/Kernel/RngMessageRules.php \Drupal\Tests\rng\Kernel\RngMessageRules::testRngRegistrationCreateMessages()
Test messages are sent on registration creation.
File
- tests/
src/ Kernel/ RngMessageRules.php, line 111
Class
- RngMessageRules
- Tests RNG message rules are executed.
Namespace
Drupal\Tests\rng\KernelCode
public function testRngRegistrationCreateMessages() {
$this->rule
->set('trigger_id', 'entity:registration:new');
$this->rule
->save();
/** @var \Drupal\rng\RngEntityModelInterface $rngEntityModel */
$rngEntityModel = $this->container
->get('rng.entity.model');
$this
->assertEquals(0, count($rngEntityModel
->getOperationRecords()), 'There are zero entity operations recorded.');
$this
->assertEquals(0, $this
->countMessagesInQueue(), 'There are zero messages in queue.');
$event = $this->eventMeta
->getEvent();
$identity = $this
->createUser();
$registration = Registration::create([
'type' => $this->registrationType
->id(),
]);
$registration
->setEvent($event)
->addIdentity($identity)
->save();
$this
->terminateRequest();
$this
->assertEquals(1, count($rngEntityModel
->getOperationRecords()), 'There is one entity operation recorded.');
$this
->assertEquals(1, $this
->countMessagesInQueue(), 'There is one message in queue.');
}