/** * To run this method, use an url such as this: * http://jane.tomhartung.com/my_hug/jane/tom/2 */ public function myHug($to, $from, $count) { $this->myHugTracker->addMyHug($to); if (!$count) { $count = $this->config('my_hugs.settings')->get('default_count'); } return ['#theme' => 'my_hug_page', '#from' => $from, '#to' => $to, '#count' => $count]; }
public function testAddMyHug() { // Note: The ::class syntax is PHP 5.5. You can also specify the full class // name as a string literal. $state = $this->prophesize(StateInterface::class); $state->set('my_hugs.last_recipient', 'Dries')->shouldBeCalled(); $tracker = new MyHugTracker($state->reveal()); $tracker->addMyHug('Dries'); }