Scalr\Tests\Api\ApiEntityAdapterTest::testValidateObject PHP Méthode

testValidateObject() public méthode

Test validate object
public testValidateObject ( )
    public function testValidateObject()
    {
        $testRequest = new stdClass();
        $testRequest->data = 'foo';
        $testRequest->queue = 'bar';
        static::$entity2Adapter->validateObject($testRequest);
        //add property that does not exist in entity
        $testRequest->bar = 'foo bar';
        try {
            static::$entity2Adapter->validateObject($testRequest);
            $this->fail('ApiErrorException is expected.');
        } catch (ApiErrorException $e) {
            $this->assertEquals(ErrorMessage::ERR_INVALID_STRUCTURE, $e->getError());
        }
    }