0

I am encountering an warning error in UnitTest cases, after upgrading from php7to php8, My folder structure is app/tests/cases/api/ In this folder I have all the test cases, I have one abstract class file BaseApiTest.php, I am using this file in all other testcases. I have tried to exclude the BaseApiTest.php file in Phpunit.xml and tried to supress the warning errors, but nothing is working..Please anyone suggest what I can do, so that the warning issue will be fixed. Thanks

Class app\tests\cases\api\BaseApiTest declared in /var/www/accounts.localhost/app/tests/cases/api/BaseApiTest.php is abstract

below is my sample codes

<?php namespace app\tests\cases\api; use accounts\test\Integration; use PHPUnit\DbUnit\DataSet\YamlDataSet; abstract class BaseApiTest extends Integration { } ?> 

below is the phpunit.xml file

<?xml version="1.0" encoding="UTF-8"?> <phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="phpunit.xsd" bootstrap="tests/bootstrap.php" cacheDirectory=".phpunit.cache" beStrictAboutOutputDuringTests="true" failOnRisky="true" failOnWarning="true" colors="true"> <testsuite name="My Test Suite"> <directory suffix="Test.php">./tests</directory> </testsuite> <source restrictDeprecations="true" restrictNotices="true" restrictWarnings="true"> <include> <directory suffix=".php">src</directory> </include> <exclude> <file>app/tests/cases/api/BaseApiTest.php</file> </exclude> </source> </phpunit> 
3
  • Per this thread it sounds like the recommendation is to just rename the class to something that doesn't end in just Test Commented Dec 11, 2024 at 20:42
  • Thanks @ChrisHaas, The above post shed some light on my question, I will try to rename the abstract file name to BaseApiTestCase and will check. and also I am thinking to upgrade PHPunit to 11 version, whether the issue will still fix or not Commented Dec 12, 2024 at 4:00
  • While burning the phpunit-10 tag, just reminded me: stackoverflow.com/a/5934435/367456 Commented Jan 15 at 18:33

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.