Exemplo n.º 1
0
 public function build()
 {
     if ($this->configuration['enabled']) {
         $message = $this->t('@to was the last person hugged', ['@to' => $this->hugTracker->getLastRecipient()]);
     } else {
         $message = $this->t('No hugs :-(');
     }
     return ['#markup' => $message];
 }
Exemplo n.º 2
0
 public function testGetLastRecipient()
 {
     $state = $this->prophesize(StateInterface::class);
     $state->get('hugs.last_recipient')->willReturn('Dries');
     $tracker = new HugTracker($state->reveal());
     $this->assertEquals('Dries', $tracker->getLastRecipient());
 }