PhpSchool\LearnYouPhp\Exercise\HttpJsonApi::getType PHP Method

getType() public method

public getType ( ) : PhpSchool\PhpWorkshop\Exercise\ExerciseType
return PhpSchool\PhpWorkshop\Exercise\ExerciseType
    public function getType()
    {
        return ExerciseType::CGI();
    }

Usage Example

 public function testHttpJsonApiExercise()
 {
     $e = new HttpJsonApi();
     $this->assertEquals('HTTP JSON API', $e->getName());
     $this->assertEquals('HTTP JSON API - Servers JSON when it receives a GET request', $e->getDescription());
     $this->assertEquals(ExerciseType::CGI, $e->getType());
     $requests = $e->getRequests();
     $request1 = $requests[0];
     $request2 = $requests[1];
     $this->assertInstanceOf(RequestInterface::class, $request1);
     $this->assertInstanceOf(RequestInterface::class, $request2);
     $this->assertSame('GET', $request1->getMethod());
     $this->assertSame('GET', $request2->getMethod());
     $this->assertSame('www.time.com', $request1->getUri()->getHost());
     $this->assertSame('www.time.com', $request2->getUri()->getHost());
     $this->assertSame('/api/parsetime', $request1->getUri()->getPath());
     $this->assertSame('/api/unixtime', $request2->getUri()->getPath());
     $this->assertInstanceOf(SolutionInterface::class, $e->getSolution());
     $this->assertFileExists(realpath($e->getProblem()));
     $this->assertNull($e->tearDown());
 }