SensioLabs\Insight\Sdk\Tests\ApiTest::testGetAnalysis PHP Method

testGetAnalysis() public method

public testGetAnalysis ( )
    public function testGetAnalysis()
    {
        $this->pluginMockResponse->addResponse($this->createResponse('analysis'));
        $analysis = $this->api->getAnalysis('6718526f-ecdf-497d-bffb-8512f0b402ea', 1);
        $this->assertInstanceOf('SensioLabs\\Insight\\Sdk\\Model\\Analysis', $analysis);
        $this->assertSame(49, $analysis->getNumber());
        $this->assertSame('error', $analysis->getGrade());
        $this->assertSame('bronze', $analysis->getNextGrade());
        $this->assertSame(array('error', 'bronze', 'silver', 'gold', 'platinum'), $analysis->getGrades());
        $this->assertSame(181.75, $analysis->getRemediationCost());
        $this->assertSame(55.5, $analysis->getRemediationCostForNextGrade());
        $this->assertSame('2013-06-25T19:37:20+02:00', $analysis->getBeginAt()->format('c'));
        $this->assertSame('2013-06-25T19:37:53+02:00', $analysis->getEndAt()->format('c'));
        $this->assertSame('0', $analysis->getDuration()->format('%s'));
        $this->assertSame(250, $analysis->getNbViolations());
        $this->assertNull($analysis->getFailureMessage());
        $this->assertNull($analysis->getFailureCode());
        $this->assertFalse($analysis->isAltered());
        $this->assertInstanceOf('SensioLabs\\Insight\\Sdk\\Model\\Violations', $analysis->getViolations());
        $this->assertCount(250, $analysis->getViolations()->getViolations());
        $violations = $analysis->getViolations()->getViolations();
        $firstViolation = reset($violations);
        $this->assertInstanceOf('SensioLabs\\Insight\\Sdk\\Model\\Violation', $firstViolation);
        $this->assertSame(7, $firstViolation->getLine());
        $this->assertSame('critical', $firstViolation->getSeverity());
        $this->assertSame('security', $firstViolation->getCategory());
        $this->assertSame('snippets/001-HelloWorld.php', $firstViolation->getResource());
    }