Exemplo n.º 1
0
 public function testSetAtPosition()
 {
     $collection = $this->getCollection();
     $message1 = new \Krucas\Notification\Message();
     $message1->setPosition(2);
     $message2 = new \Krucas\Notification\Message();
     $message2->setPosition(1);
     $collection->add($message1)->add($message2);
     $this->assertEquals($message2, $collection[0]);
     $this->assertEquals($message1, $collection[1]);
 }
 public function testMessageToJson()
 {
     $message = new \Krucas\Notification\Message('error', 'test message', false, ':type: :message');
     $this->assertEquals('{"message":"test message","format":":type: :message","type":"error","flashable":false,"alias":null,"position":null}', $message->toJson());
 }
Exemplo n.º 3
0
 public function testMethodsShortcuts()
 {
     $message = new \Krucas\Notification\Message();
     $this->assertNull($message->getMessage());
     $this->assertNull($message->getFormat());
     $this->assertNull($message->getPosition());
     $this->assertTrue($message->isFlash());
     $message->message('test')->format(':message')->position(5);
     $this->assertEquals('test', $message->getMessage());
     $this->assertEquals(':message', $message->getFormat());
     $this->assertEquals(5, $message->getPosition());
     $this->assertTrue($message->isFlash());
     $message->instant();
     $this->assertFalse($message->isFlash());
     $message->flash();
     $this->assertTrue($message->isFlash());
 }