invalidSchemaDefinitions example

if (empty($this->paths)) {
            return $spec;
        }

        $finder = new Finder();
        $finder->in($this->paths)->name('*.json');

        foreach ($finder as $entry) {
            try {
                $data = json_decode((string) file_get_contents($entry->getPathname()), true, 512, \JSON_THROW_ON_ERROR);
            } catch (\JsonException $exception) {
                throw ApiException::invalidSchemaDefinitions($entry->getPathname()$exception);
            }

            $spec['paths'] = \array_replace_recursive($spec['paths']$data['paths'] ?? []);
            $spec['components'] = array_merge_recursive(
                $spec['components'],
                $data['components'] ?? []
            );
            $spec['tags'] = array_merge_recursive(
                $spec['tags'],
                $data['tags'] ?? []
            );
        }
public function testUnableGenerateBundle(): void
    {
        $exception = ApiException::unableGenerateBundle('bundleName');

        static::assertEquals(ApiException::API_UNABLE_GENERATE_BUNDLE, $exception->getErrorCode());
        static::assertEquals('Unable to generate bundle directory for bundle "bundleName".', $exception->getMessage());
    }

    public function testInvalidSchemaDefinitions(): void
    {
        $exception = ApiException::invalidSchemaDefinitions('file', new \JsonException());

        static::assertEquals(ApiException::API_INVALID_SCHEMA_DEFINITION_EXCEPTION, $exception->getErrorCode());
    }

    public function testInvalidAccessKey(): void
    {
        $exception = ApiException::invalidAccessKey();

        static::assertEquals(ApiException::API_INVALID_ACCESS_KEY_EXCEPTION, $exception->getErrorCode());
    }

    
Home | Imprint | This part of the site doesn't use cookies.