Scalr\Tests\Functional\Api\V2\TestData\ApiFixture::prepareRoleImage PHP Method

prepareRoleImage() protected method

Creates and save RoleImage entity with data from fixtures
protected prepareRoleImage ( string $name )
$name string Role category data name
    protected function prepareRoleImage($name)
    {
        foreach ($this->sets[$name] as &$roleImageData) {
            if (in_array($roleImageData['platform'], [SERVER_PLATFORMS::GCE, SERVER_PLATFORMS::AZURE])) {
                $roleImageData['cloudLocation'] = '';
            }
            /* @var $image  Entity\Image */
            $image = Entity\Image::findOne([['cloudLocation' => $roleImageData['cloudLocation']], ['platform' => $roleImageData['platform']], ['$or' => [['accountId' => static::$user->getAccountId()], ['accountId' => null]]]]);
            if (empty($image)) {
                ApiTest::markTestIncomplete(sprintf('Image with cloudLocation %s and platform %s not isset', $roleImageData['cloudLocation'], $roleImageData['platform']));
            }
            $roleImageData['imageId'] = $image->id;
            ApiTest::createEntity(new Entity\RoleImage(), $roleImageData);
        }
    }