예제 #1
0
 /**
  * Tests the clear() method.
  *
  * @return void
  */
 public function testClear()
 {
     $this->viewDo->set('test1', 1);
     $this->viewDo->set('test2', 2);
     $this->assertEquals(1, $this->viewDo->get('test1'));
     $this->assertEquals(2, $this->viewDo->get('test2'));
     $this->viewDo->clear();
     try {
         $this->assertNull($this->viewDo->get('test1'));
         $this->fail('This method should trigger an error when a nonexistent key accessed.');
     } catch (\Exception $e) {
         $this->assertTrue($e instanceof ErrorException, 'Should have thrown an ErrorException');
     }
     try {
         $this->assertNull($this->viewDo->get('test2'));
         $this->fail('This method should trigger an error when a nonexistent key accessed.');
     } catch (\Exception $e) {
         $this->assertTrue($e instanceof ErrorException, 'Should have thrown an ErrorException');
     }
 }