fakeHTTP = $this->createMock( HttpRequestFactory::class ); $this->fakeWAN = $this->createMock( WANObjectCache::class ); } public function testNewMathoidChecker() { $checker = $this->newServiceInstance( InputCheckFactory::class, [] ) ->newMathoidChecker( 'FORMULA', 'TYPE' ); $this->assertInstanceOf( MathoidChecker::class, $checker ); } public function testNewRestbaseChecker() { $checker = $this->newServiceInstance( InputCheckFactory::class, [] ) ->newRestbaseChecker( 'FORMULA', 'TYPE' ); $this->assertInstanceOf( RestbaseChecker::class, $checker ); } public function testNewLocalChecker() { $checker = $this->newServiceInstance( InputCheckFactory::class, [] ) ->newLocalChecker( 'FORMULA', 'tex' ); $this->assertInstanceOf( LocalChecker::class, $checker ); } public function testInvalidLocalChecker() { $this->expectException( InvalidArgumentException::class ); $this->newServiceInstance( InputCheckFactory::class, [] ) ->newLocalChecker( 'FORMULA', 'invalidtype' ); } public function testNewDefaultChecker() { $checker = $this->newServiceInstance( InputCheckFactory::class, [] ) ->newDefaultChecker( 'FORMULA', 'TYPE' ); $this->assertInstanceOf( RestbaseChecker::class, $checker ); } public function testNewMLocalCheckerDefault() { $myFactory = new InputCheckFactory( new ServiceOptions( InputCheckFactory::CONSTRUCTOR_OPTIONS, [ 'MathMathMLUrl' => 'something', 'MathTexVCService' => 'local', 'MathLaTeXMLTimeout' => 240 ] ), $this->fakeWAN, $this->fakeHTTP, LoggerFactory::getInstance( 'Math' ) ); $checker = $myFactory->newDefaultChecker( 'FORMULA', 'tex' ); $this->assertInstanceOf( LocalChecker::class, $checker ); } public function testMathoidCheckerInDefault() { $myFactory = new InputCheckFactory( new ServiceOptions( InputCheckFactory::CONSTRUCTOR_OPTIONS, [ 'MathMathMLUrl' => 'something', 'MathTexVCService' => 'mathoid', 'MathLaTeXMLTimeout' => 240 ] ), $this->fakeWAN, $this->fakeHTTP, LoggerFactory::getInstance( 'Math' ) ); $checker = $myFactory->newDefaultChecker( 'FORMULA', 'TYPE' ); $this->assertInstanceOf( MathoidChecker::class, $checker ); } }