markTestSkippedIfExtensionNotLoaded( 'WikibaseClient' ); parent::setUp(); } /** * @param string $test * @return string */ private function makeCase( $test ) { $builder = new MathMLRdfBuilder(); $writer = new NTriplesRdfWriter(); $writer->prefix( 'www', "http://www/" ); $writer->prefix( 'acme', self::ACME_PREFIX_URL ); $writer->start(); $writer->about( 'www', 'Q1' ); $snak = new PropertyValueSnak( new NumericPropertyId( 'P1' ), new StringValue( $test ) ); $builder->addValue( $writer, 'acme', self::ACME_REF, 'DUMMY', '', $snak ); return trim( $writer->drain() ); } public function testValidInput() { $this->setupGoodMathRestBaseMockHttp(); $triples = $this->makeCase( '\sin x^2' ); $this->assertStringContainsString( self::ACME_PREFIX_URL . self::ACME_REF . '> "assertStringContainsString( 'sin\n', $triples ); $this->assertStringContainsString( '2\n', $triples ); $this->assertStringContainsString( 'x^{2}', $triples ); $this->assertStringContainsString( '^^ .', $triples ); } public function testInvalidInput() { $this->setupBadMathRestBaseMockHttp(); $triples = $this->makeCase( '\sin\newcommand' ); $this->assertStringContainsString( 'assertStringContainsString( 'unknown function', $triples ); $this->assertStringContainsString( 'newcommand', $triples ); $this->assertStringContainsString( '^^ .', $triples ); } }