Example #1
0
 /**
  * Test Flash session key
  *
  * Pre-conditions:
  * Case A: Use default key
  * Case B: Use custom string key
  * Case C: Use null key
  * Case D: Set null key directly
  *
  * Post-conditions:
  * Case A: Key === 'flash'
  * Case B: Key === 'foo'
  * Case C: Key === 'flash'
  * Case D: Catch RuntimeException
  */
 public function testFlashSessionKey()
 {
     //Case A
     $f1 = new Slim_Session_Flash();
     $this->assertEquals('flash', $f1->getSessionKey());
     //Case B
     $f2 = new Slim_Session_Flash('foo');
     $this->assertEquals('foo', $f2->getSessionKey());
     //Case C
     $f3 = new Slim_Session_Flash(null);
     $this->assertEquals('flash', $f3->getSessionKey());
     //Case D
     try {
         $f3->setSessionKey(null);
         $this->fail('Did not catch RuntimeException when setting null session key');
     } catch (RuntimeException $e) {
     }
 }