DefinitionTest::testGetDPUBreakdownOnInvalidDefinition PHP Метод

testGetDPUBreakdownOnInvalidDefinition() публичный Метод

    public function testGetDPUBreakdownOnInvalidDefinition()
    {
        $def = new DataSift_Definition($this->user, testdata('invalid_definition'));
        $this->assertEquals($def->get(), testdata('invalid_definition'));
        $response = array('response_code' => 400, 'data' => array('error' => 'The target interactin.content does not exist'), 'rate_limit' => 200, 'rate_limit_remaining' => 150);
        DataSift_MockApiClient::setResponse($response);
        try {
            $def->getDPUBreakdown();
            $this->fail('CompileFailed exception expected, but not thrown');
        } catch (DataSift_Exception_InvalidData $e) {
            // Check the error message
            $this->assertEquals($e->getMessage(), $response['data']['error']);
        } catch (DataSift_Exception_APIError $e) {
            $this->fail('APIError: ' . $e->getMessage() . ' (' . $e->getCode() . ')');
        } catch (Exception $e) {
            $this->fail('Unhandled exception: ' . $e->getMessage() . ' (' . $e->getCode() . ')');
        }
    }