[img]https://i.sstatic.net /l5P8uy9F.png[/img]
Если я создал тестовый файл и включил его с помощью require, я получил рискованное предупреждение от phpunit
There was 1 risky test:
1) headerTest::testheader
This test executed code that is not listed as code to be covered or used:
- /opt/homebrew/var/www/wp-content/themes/flex/patterns/header.php:10
- /opt/homebrew/var/www/wp-content/themes/flex/patterns/header.php:11
- /opt/homebrew/var/www/wp-content/themes/flex/patterns/header.php:12
- /opt/homebrew/var/www/wp-content/themes/flex/patterns/header.php:13
- /opt/homebrew/var/www/wp-content/themes/flex/patterns/header.php:14
- /opt/homebrew/var/www/wp-content/themes/flex/patterns/header.php:15
- /opt/homebrew/var/www/wp-content/themes/flex/patterns/header.php:16
- /opt/homebrew/var/www/wp-content/themes/flex/patterns/header.php:29
/opt/homebrew/var/www/wp-content/tests/themes/patterns/headerTest.php:23
И это не учтено в данных об охвате.
[*]
Другие файлы тем, которые мы успешно рассмотрели с помощью тестовых файлов, используя такие атрибуты, как #[CoversFunction] и #[CoversClass].
Я обратился за помощью к AI чтобы создать тестовый код ниже, но код заголовка по-прежнему считается не охваченным и добавляет рискованный оператор.
- HeaderTest::testHeaderStructure
Этот тест не определить цель покрытия кода, но ожидается, что это будет сделано
Подробнее здесь: https://stackoverflow.com/questions/791 ... punit-test