Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bad progress output with option --functional #826

Closed
ax-ml opened this issue Dec 21, 2023 · 5 comments · Fixed by #828
Closed

Bad progress output with option --functional #826

ax-ml opened this issue Dec 21, 2023 · 5 comments · Fixed by #828
Labels

Comments

@ax-ml
Copy link
Contributor

ax-ml commented Dec 21, 2023

Q A
ParaTest version 7.3.1
PHPUnit version 10.5.3
PHP version 8.3.0

Summary

I've just updated the versions of Paratest and Phpunit. When I use the "-functional" option, I get a problem in the output. The progress exceeds the actual number of tests.

This is my phpunit.xml :

<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd" colors="true" bootstrap="tests/bootstrap.php" backupGlobals="false">
  <php>
    <ini name="error_reporting" value="-1"/>
    <server name="APP_ENV" value="test" force="true"/>
    <env name="APP_ENV" value="test" force="true"/>
    <server name="SHELL_VERBOSITY" value="-1"/>
    <server name="SYMFONY_PHPUNIT_REMOVE" value=""/>
    <server name="SYMFONY_PHPUNIT_VERSION" value="10.5"/>
    <server name="KERNEL_CLASS" value="App\Kernel"/>
  </php>
  <testsuites>
    <testsuite name="Core">
      <directory>tests/Controller</directory>
    </testsuite>
  </testsuites>
  <extensions>
    <bootstrap class="DAMA\DoctrineTestBundle\PHPUnit\PHPUnitExtension"/>
  </extensions>
  <source>
    <include>
      <directory>src</directory>
      <directory>modules/*/src</directory>
    </include>
    <exclude>
      <directory>src/Contract</directory>
      <directory>src/DataFixtures</directory>
      <directory>src/DataFixtures</directory>
      <directory>src/DeliveryServiceTemplates</directory>
      <directory>src/DependencyInjection</directory>
      <directory>src/Deploy</directory>
      <directory>src/Doctrine</directory>
      <directory>src/Entity</directory>
      <directory>src/Enum</directory>
      <directory>src/Event</directory>
      <directory>src/Factory</directory>
      <directory>src/MailEvent</directory>
      <directory>src/Model</directory>
      <directory>src/Page</directory>
      <directory>src/Routing</directory>
      <directory>src/Translation</directory>
      <file>src/CoreBundle.php</file>
      <file>src/Kernel.php</file>
      <directory>modules/*/src/Contract</directory>
      <directory>modules/*/src/DataFixtures</directory>
      <directory>modules/*/src/DeliveryServiceTemplates</directory>
      <directory>modules/*/src/DependencyInjection</directory>
      <directory>modules/*/src/Deploy</directory>
      <directory>modules/*/src/Doctrine</directory>
      <directory>modules/*/src/Entity</directory>
      <directory>modules/*/src/Enum</directory>
      <directory>modules/*/src/Event</directory>
      <directory>modules/*/src/Factory</directory>
      <directory>modules/*/src/MailEvent</directory>
      <directory>modules/*/src/Model</directory>
      <directory>modules/*/src/Page</directory>
      <directory>modules/*/src/Routing</directory>
      <directory>modules/*/src/Translation</directory>
    </exclude>
  </source>
</phpunit>

Current behavior

Result without "--functional" :

paratest_without_functional

Result with "--functional" :

paratest_with_functional

How to reproduce: command, code and error stack trace

Without bug :

php ./vendor/bin/paratest --configuration=phpunit.xml.dist --no-coverage -p8

With bug :

php ./vendor/bin/paratest --configuration=phpunit.xml.dist --no-coverage -p8 --functional

You need to have methods with the same beginning of names in the same class.

Expected behavior

Obtain the same output with and without the option "--functional"

@ax-ml ax-ml added the bug label Dec 21, 2023
@ax-ml
Copy link
Contributor Author

ax-ml commented Dec 21, 2023

I've found my problem. I have methods that have the same beginning names. The filter added in

$name = substr($testPath, $null + 1);
is based on the method name.

To solve my problem I replaced

$name = substr($testPath, $null + 1);

with

$name = "/" . substr($testPath, $null + 1) . "$/";

@ax-ml
Copy link
Contributor Author

ax-ml commented Dec 21, 2023

Resulte with my suggest
paratest_solved

@netdjw
Copy link

netdjw commented Feb 9, 2024

same here

@Slamdunk
Copy link
Member

The fix has already been proposed, but it needs deeper tests to get merged #828

Any help is welcome

@ax-ml
Copy link
Contributor Author

ax-ml commented Feb 19, 2024

I'm sorry, I fixed this issue only if dataProvider is used. I still have the problem without dataProvider but I have the solution 👀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging a pull request may close this issue.

3 participants