toggleConditionLimit( false ); $cachingParser = new AbuseFilterCachingParser( $contLang, $cache, $logger ); $cachingParser->toggleConditionLimit( false ); $parsers = [ $parser, $cachingParser ]; } else { // Reset so that already executed tests don't influence new ones $parsers[0]->resetState(); $parsers[0]->clearFuncCache(); $parsers[1]->resetState(); $parsers[1]->clearFuncCache(); } return $parsers; } /** * Base method for testing exceptions * * @param string $excep Identifier of the exception (e.g. 'unexpectedtoken') * @param string $expr The expression to test * @param string $caller The function where the exception is thrown, if available * The method may be different in Parser and CachingParser, but this parameter is * just used for debugging purposes. */ protected function exceptionTest( $excep, $expr, $caller ) { foreach ( $this->getParsers() as $parser ) { $pname = get_class( $parser ); try { $parser->parse( $expr ); } catch ( AFPUserVisibleException $e ) { $this->assertEquals( $excep, $e->mExceptionID, "Exception $excep not thrown in $caller. Parser: $pname." ); continue; } $this->fail( "Exception $excep not thrown in $caller. Parser: $pname." ); } } }