public get ( $type ) : Krucas\Notification\Collection | ||
$type | ||
Résultat | Krucas\Notification\Collection |
public function get($type)
{
$collection = new Collection();
foreach ($this->notifications as $key => $message) {
if ($message->getType() == $type) {
$collection->add($message);
}
}
return $collection;
}
/** * @depends testGetErrorMessageContainer */ public function testGetFirstMessageFromContainer(\Krucas\Notification\NotificationsBag $bag) { $this->assertInstanceOf('Krucas\\Notification\\Message', $bag->get('error')->first()); $this->assertEquals('test error', $bag->get('error')->first()->getMessage()); $this->assertEquals('error', $bag->get('error')->first()->getType()); $this->assertEquals(':message!', $bag->get('error')->first()->getFormat()); return $bag; }