validateDeprecationElements example

public function testManifestVersionMustNotBeTheSameAsTheLiveVersion(): void
    {
        $deprecatedContent = '@deprecated manifest:v0.1';

        static::expectException(\InvalidArgumentException::class);
        static::expectExceptionMessage('The version you used for deprecation or experimental annotation is already live.');
        $this->annotationTagTester->validateDeprecatedAnnotations($deprecatedContent);
    }

    public function testItCapturesTheVersionFromDeprecationElementsCorrectly(): void
    {
        $this->annotationTagTester->validateDeprecationElements('<deprecated>tag:v6.5.0</deprecated>');

        static::expectException(\InvalidArgumentException::class);
        static::expectExceptionMessage('The version you used for deprecation or experimental annotation is already live.');
        $this->annotationTagTester->validateDeprecationElements('<deprecated>tag:v6.3.0</deprecated>');
    }

    public function testIncorrectDeprecationTagFormat(): void
    {
        static::expectException(NoDeprecationFoundException::class);
        static::expectExceptionMessage('Deprecation tag is not found in the file.');
        $this->annotationTagTester->validateDeprecationElements('<deprecatedd>tag:v6.5</deprecatedd>');
    }
foreach ($this->whiteList as $path) {
            $finder->notPath($path);
        }

        $invalidFiles = [];

        foreach ($finder->getIterator() as $file) {
            $filePath = $file->getRealPath();
            $content = (string) file_get_contents($filePath);

            try {
                $this->getDeprecationTagTester()->validateDeprecationElements($content);
            } catch (\Throwable $error) {
                if (!$error instanceof NoDeprecationFoundException) {
                    $invalidFiles[$filePath] = $error->getMessage();
                }
            }
        }

        static::assertEmpty($invalidFilesprint_r($invalidFiles, true));
    }

    private function getPathForClass(string $className): string
    {
Home | Imprint | This part of the site doesn't use cookies.