/**
  * Test the Notices::add_unique(...) method
  *
  * @test
  * @dataProvider providerAddUnique
  */
 public function testAddUnique($type, $message, $persist, $allowed)
 {
     // Put an initial Notice in the Notices queue
     $original = Notices::add('success', 'You have succeeded!', FALSE);
     // Try to create a unique Notice
     $result = Notices::add_unique($type, $message, $persist);
     // Retrieve the Notices queue
     $notices = Session::instance()->get('notices', array());
     // Make sure that uniqueness is enforced
     $this->assertSame($allowed, (bool) $result);
     // If it was unique, perform assertions similar to testAdd
     if ($result) {
         // Make sure the result is a Notice
         $this->assertTrue($result instanceof Notice);
         // Make sure the result was added to the session
         $this->assertTrue(isset($notices[$result->hash]));
         // Make sure the notice in the session matches the result
         $this->assertTrue($result->similar_to($notices[$result->hash]));
     }
 }
 /**
  * The `__callStatic()` allows the creation of notices using the shorter
  * syntax: `Notices::success('message');` This works for PHP 5.3+ only
  *
  * @param	string	$method  Method name
  * @param	array	$args    method arguments
  * @return	mixed
  */
 public static function __callStatic($method, $args)
 {
     if (strpos($method, Notices::UNIQUE_PREFIX) === 0) {
         return Notices::add_unique(substr($method, strlen(Notices::UNIQUE_PREFIX)), Arr::get($args, 0), Arr::get($args, 1), Arr::get($args, 2));
     } else {
         return Notices::add($method, Arr::get($args, 0), Arr::get($args, 1), Arr::get($args, 2));
     }
 }