'sformsselect', 'approach' => 'smw', 'query' => 'abc', 'sep' => ',' ]; $this->ApiMain = new ApiMain( $this->newRequestContext( $parameters ), true ); $this->ApiSFS = new ApiSemanticFormsSelect( $this->ApiMain, 'sformsselect' ); } protected function tearDown() { unset( $this->ApiSFS ); unset( $this->ApiMain ); parent::tearDown(); } public function testCanConstruct() { $apiMain = new ApiMain( $this->newRequestContext( [] ), true ); $instance = new ApiSemanticFormsSelect( $apiMain, 'sformsselect' ); $this->assertInstanceOf( '\SFS\ApiSemanticFormsSelect', $this->ApiSFS ); } public function testExecute() { $this->assertTrue( $this->ApiSFS->execute() ); } public function testGetDescription() { $tdata = [ 'API for providing SemanticFormsSelect values' ]; $this->assertEquals( $this->ApiSFS->getDescription(), $tdata ); } public function testGetParamDescription() { $tdata = [ 'approach' => 'The actual approach: function or smw', 'query' => 'The query of the former' ]; $this->assertEquals( $this->ApiSFS->getParamDescription(), $tdata ); } public function testGetVersion() { $tdata = 'SFS\ApiSemanticFormsSelect: 1.1'; $this->assertEquals( $this->ApiSFS->getVersion(), $tdata ); } private function newRequestContext( $request = [] ) { $context = new RequestContext(); if ( $request instanceof WebRequest ) { $context->setRequest( $request ); } else { $context->setRequest( new FauxRequest( $request, true ) ); } return $context; } }