checkBackend( true ); } /** * Sets up the fixture, for example, opens a network connection. * This method is called before a test is executed. */ protected function setUp() { parent::setUp(); if ( !self::$hasRestbase ) { $this->markTestSkipped( "Can not connect to Restbase Math interface." ); } } /** * * @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 PropertyId( 'P1' ), new StringValue( $test ) ); $builder->addValue( $writer, 'acme', self::ACME_REF, 'DUMMY', $snak ); return trim( $writer->drain() ); } public function testValidInput() { $triples = $this->makeCase( 'a^2' ); $this->assertContains( self::ACME_PREFIX_URL . self::ACME_REF . '> "assertContains( 'a\n', $triples ); $this->assertContains( '2\n', $triples ); $this->assertContains( 'a^{2}', $triples ); $this->assertContains( '^^ .', $triples ); } public function testInvalidInput() { $triples = $this->makeCase( '\notExists' ); $this->assertContains( 'assertContains( 'unknown function', $triples ); $this->assertContains( 'notExists', $triples ); $this->assertContains( '^^ .', $triples ); } }