예제 #1
0
 /**
  *
  * @dataProvider formatDataProvider
  */
 public function testView($format)
 {
     $this->object->setFormat($format);
     $this->object->getView()->setTemplatePath(dirname(__FILE__) . '/_fixtures/TestTemplate.php');
     $this->object->setVal(self::TEST_VAL_NAME, self::TEST_VAL_VALUE);
     if ($format == 'json') {
         $this->object->setException(new WikiaException('TestException'));
     }
     $this->object->sendHeaders();
     ob_start();
     print $this->object;
     $buffer = ob_get_contents();
     ob_end_clean();
     if ($format == 'html') {
         $this->assertEquals(self::TEST_VAL_VALUE, $buffer);
     }
 }