Example #1
0
 /**
  * Tests clear() empties the message bag
  *
  * @return  void
  **/
 public function testClear()
 {
     $handler = new Handler(new Memory());
     foreach ($this->data as $item) {
         $handler->message($item['message'], $item['type'], 'one');
     }
     foreach ($this->data as $item) {
         $handler->message($item['message'], $item['type'], 'two');
     }
     $handler->clear('one');
     $this->assertTrue($handler->isEmpty('one'));
     $this->assertFalse($handler->any('one'));
     $m = $handler->messages('one');
     $this->assertCount(0, $m, 'Total messages returned does not equal number added');
     $this->assertFalse($handler->isEmpty('two'));
     $this->assertTrue($handler->any('two'));
     $m = $handler->messages('two');
     $this->assertCount(count($this->data), $m, 'Total messages returned does not equal number added');
 }
Example #2
0
 /**
  * Test that isEmpty() returns TRUE if there are no
  * messages and FALSE if there.
  *
  * @covers  \Hubzero\Notification\Handler::isEmpty
  * @return  void
  **/
 public function testIsEmpty()
 {
     $handler = new Handler(new Memory());
     $this->assertTrue($handler->isEmpty());
     $handler->error('Lorem ipsum dol.');
     $this->assertFalse($handler->isEmpty());
 }