/** * @expectedException MustacheException */ public function testGetPragmaOptionsThrowsExceptionsIfItThinksYouHaveAPragmaButItTurnsOutYouDont() { $mustache = new TestableMustache(); $mustache->testableGetPragmaOptions('PRAGMATIC'); }
public function testOverrideThrownExceptionsViaConstructorOptions() { $exceptions = array(MustachePHPException::UNKNOWN_VARIABLE, MustachePHPException::UNCLOSED_SECTION, MustachePHPException::UNEXPECTED_CLOSE_SECTION, MustachePHPException::UNKNOWN_PARTIAL, MustachePHPException::UNKNOWN_PRAGMA); $one = new TestableMustache(null, null, null, array('throws_exceptions' => array_fill_keys($exceptions, true))); $thrownExceptions = $one->getThrownExceptions(); foreach ($exceptions as $exception) { $this->assertTrue($thrownExceptions[$exception]); } $two = new TestableMustache(null, null, null, array('throws_exceptions' => array_fill_keys($exceptions, false))); $thrownExceptions = $two->getThrownExceptions(); foreach ($exceptions as $exception) { $this->assertFalse($thrownExceptions[$exception]); } }