NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
Debugging with PHPUnit


Joined: 10 Jun 2014
Posts: 7
Reply with quote
I have tried to report this via the contact form as a bug on three occasions, but I have never received a confirmation email.

Windows 11 Home,version 22H2
PhpEd 20 Professional (Build 20030 64bit)
PHP version: 8.2.4, ts: 1, sapi: cli
PHPUnit version: 9.6.4
debugger version: 11.0.22, enabled
PhpUnit listener version: 20.0.20029

When running all tests, the Test Suite executes (PHPUnit reports the result) but the tests are greyed with "status: didn't run".

When using the "Debug It" context menu item, PHPUnit reports "No tests executed!". The test is greyed with "status: didn't run".

I think that this second issue is due to the formatting of the --filter param which is passed to PHPUnit, because it has 3 backslashes between the namespace elements: Here are the command-line args passed to my interception script:

0: C:\Users\John\projects\phped\phpunit-params.php
1: --configuration
2: C:\Users\John\projects\phped\phped_unittest.xml
3: --filter
4: /^(App\\\Tests\\\MainTest::testFalse)$/

If the 3 backslashes are replaced by 2 backslashes, the test executes (but is still shown as "status: didn't run").

Note that my debug configuration works correctly and I can step through php scripts.

Thanks,
John Stevenson
View user's profileFind all posts by JohnStevensonSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 8334
Reply with quote
Thanks for report,
Can you update to PhpED 20032 / dbg 11.0.24 and double check? (Make sure that the project Wizard passed all the tests with no warnings or errors)
If it still has problem showing test status make sure that the config (phpunit.xml) is not updated to phpUnit v9 format. phpUnit will post a warning and offer to upgrade config, just ignore it for now.
If you have already upgraded configuration, I think you have no option but re-create it from scratches according to phpUnit v8 or v7 docs.
Note that the config that PhpED uses -- phped_unittest.xml is directly derived from phpunit.xml with listener and coverage options added on top of it. With new format this may not work correctly, leaving it without the listener and this is why communication between phpUnit and PhpED, through the debugger, may not work and the status remains stale.

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website


Joined: 10 Jun 2014
Posts: 7
Reply with quote
Thanks for the very prompt response. Using PhpED 20032 / dbg 11.0.24:

- When running all tests, the Test Suite executes (PHPUnit reports the result) and the tests are green with "status: passed".

- When using the "Debug It" context menu item, PHPUnit reports "No tests executed!". The test is greyed with "status: didn't run".

So the debugging issue still exists (and the namespaces in the --filter argument still have 3-backslash separators). But I can debug the tests by invoking them myself:

Code:

<?php

$tests = [
    'App\\\\Tests\\\\MainTest::testTrue',
];

$php = '"'.PHP_BINARY.'"';
$phpunit = 'C:/Users/John/AppData/Roaming/NuSphere/PhpED/unitTest/phpunit-9.6.4.phar';
$filter = sprintf('"%s"', implode('|', $tests));
$args = [$php, $phpunit, '--filter', $filter];
$command = implode(' ', $args);

passthru($command);



I used the following phpunit.xml file (based on the one at at gihub phpunit, branch 8.5). But I did not get a warning from phpunit about the format.

Code:

<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:noNamespaceSchemaLocation="phpunit.xsd"
         backupGlobals="false"
         backupStaticAttributes="false"
         bootstrap="C:\Users\John\projects\phped\vendor\autoload.php"
         colors="true"
         convertErrorsToExceptions="true"
         convertNoticesToExceptions="true"
         convertWarningsToExceptions="true"
         processIsolation="false"
         stopOnFailure="false"
         stopOnError="false"
         stopOnSkipped="false"
         stopOnIncomplete="false">
    <testsuites>
        <testsuite name="unit">
            <directory>tests</directory>
        </testsuite>
    </testsuites>
</phpunit>
View user's profileFind all posts by JohnStevensonSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 8334
Reply with quote
Thanks. I thought it relates to issues we've fixed in 20032. Clearly it's not. Ok. We'll address it soon.

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website
Site Admin

Joined: 13 Jul 2003
Posts: 8334
Reply with quote
Did you get a chance to try 20033?

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website


Joined: 10 Jun 2014
Posts: 7
Reply with quote
I didn't know 20033 had been released (I didn't receive a notification and its not in my spam folder).

I'll try it today.
View user's profileFind all posts by JohnStevensonSend private message


Joined: 10 Jun 2014
Posts: 7
Reply with quote
The 20033 installer seems to have lost all my settings. It tries to install to C:\Program Files (x86)\NuSphere\PhpED rather than C:\Program Files\NuSphere\PhpED and offers me the full set of options rather than the ones I have previously chosen.

Is this expected behavior? I haven't installed it yet.
View user's profileFind all posts by JohnStevensonSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 8334
Reply with quote
No no, it's not the installer lost any settings, it's a different installer. Clearly you downloaded 32bit version of the product, this is why it tried to install where 32bit version applications belong to -- Program Files (x86) and offered you the default installation options.

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website


Joined: 10 Jun 2014
Posts: 7
Reply with quote
>> No no, it's not the installer lost any settings, it's a different installer.

Apologies, I am an idiot.

I can confirm that in 20033 the "Debug It" context menu item works correctly.

Thanks very much for fixing this so quickly.
View user's profileFind all posts by JohnStevensonSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 8334
Reply with quote
haha, no you're not. Actually you provoked a rather good question -- why the 32bit installer didn't pick-up choices you made in 64bit one.

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website
Debugging with PHPUnit
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 5 Hours  
Page 1 of 1  

  
  
 Reply to topic