Code Monkey home page Code Monkey logo

vscode-phpunit's People

Contributors

9brada6 avatar aboalnaga avatar blademf avatar daigo75 avatar dariusj18 avatar dependabot[bot] avatar elonmallin avatar eric-hansen avatar gayanhewa avatar naxvog avatar santigarcor avatar yaameen avatar yoongshang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

vscode-phpunit's Issues

Cancel Tests

I don't see a way to cancel the current test(s) in progress.

For example: Some tests require that I connect to a VPN but I may forget in advance.
Then I must wait for the tests to time out which could take a while.

If I connect to the VPN and start a new set of tests, the output of the previous tests may interject into the output and cause confusion about what has been successful or failed.

A button on the 'Output' pane, or a hotkey to stop currently running tests would be helpful.

Thank you for the truly essential plugin!

This all of a sudden stopped working for me

I've grown quite fond of using Ctrl + Alt + T to immediately run the test function I'm working on or the whole file, right within my development environment. I can tell you that my "T" key was wearing down from all the use it was getting.

This worked great all the way through yesterday evening - September 10.

This morning, Ctrl+Alt+T opens the command drop-down list and asks me to run my test class. If I hit Enter or click it, nothing happens.

commandribbon

This is the same behavior as if I hit Ctrl+Shift+P, then go to PHPUnit Test. It simply won't run tests within the editor any more. :(

I've tried reinstalling the package and restarting VSCode to no avail.

Any advice would be appreciated! Thanks!

Path Mapping

I need to run my unit tests from a virtual machine. I managed to get this extension to use the vagrant installation of PHPUnit by setting the phpunit.execPath to the following:

vagrant ssh -- /srv/api/vendor/bin/phpunit

but the path of the file I'm testing is relative to the host PC, and is not correct for my VM.

It would be great if I could specify path mapping.

Feature request: Test Directory for 2 and 3 levels up

Hi, since you've been away I've forked the extension to fix my two suggestions and I added two additional commands - "Test Directory [2]" and "Test Directory [3]" which work the same way as "Test Directory", but respectively 2 and 3 levels up from the current file.

I could PR them if you're okay with this or you can do them yourself, but they are really useful since I usually have a pretty deep directory structure for tests - if a class has more tests I tend to split them into separate files and put them in a folder with the name of the class. And so if I want to run all the tests from the class' namespace, I need a filter that is 2 directories up, not one.

I hope that this makes sense.

Using phpunit.phar

This cost me a considerable amount of time to figure out.

I was trying to use phpunit.phar and added the path to the configuration. Spawning the process failed so I decided to dig deeper. Long story short:

"phpunit.execPath": "php", // path to php or php command
"phpunit.args": [
    "C:\\php\\phpunit-6.4.4.phar" // path to phpunit.phar
],

did the trick! (using Win10 but should apply to any OS)

Would be nice to add some kind of annotation to the setup instructions.

cheers

TestRunner is scanning whole fileystsem. Not only Workspace on Windows

Repro

  1. Add Extension to project
  2. Open Testrunner tab
  3. Check Output/PHPUnit Language Server

Outcome

The Testrunner extension scans the whole file System for tests not only my workspace. I´s super slow and not what I would expect. Also warning that duplicate ID files are available.

Expected outcome

Should only scan in workspace for tests

Logs / output / settings

glob error [Error: EACCES: permission denied, scandir 'c:\Users\Christopher\AppData\Local\Microsoft\WindowsApps\SpotifyAB.SpotifyMusic_zpdnekdrzrea0\Spotify.exe'] {
errno: -4092,
code: 'EACCES',
syscall: 'scandir',
path: 'c:\Users\XXX\AppData\Local\Microsoft\WindowsApps\SpotifyAB.SpotifyMusic_zpdnekdrzrea0\Spotify.exe'
}

This is what it looks like on my machine. I´ve used the standard configs (settings)
error_phpunitTestRunner

Environment Values
Extension version 2.0.76 also older versions like v2.0.7.0
Operating system Windows 10 Pro

Test results not displaying in VSCode when using a testsuite name that contains spaces

Repro

  1. Create a few test methods, assuming a normal setup
  2. Configure a testsuite in your phpunit.xml with a testsuite name of "test repro" (see below for an example)
  3. Click "Run All Tests" from the Visual Studio Testing window

Outcome

Notice how the results of your entire test suite are not updated/reported.
It seems that the --testsuite argument value (the testsuite name) isn't put in quotes, which is somehow leading to the results not being shown in VSCode. See output below. Running individual tests works fine. Renaming the testsuite to "testRepro" fixes the issue.

Expected outcome

All the tests that are found by VSCode are updated (e.g. the result of the test is being shown both inline in code (in the case of errors) and in the Testing window).

Logs / output / settings

<phpunit
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
         bootstrap="./vendor/autoload.php">
    <testsuites>
        <testsuite name="test repro">
            <directory>tests</directory>
        </testsuite>
    </testsuites>
</phpunit>
> php -d display_errors=on "<my path>\vendor\bin\phpunit" -c phpunit.xml --teamcity --colors=never --testsuite test repro 
PHPUnit 10.5.2 by Sebastian Bergmann and contributors.
Runtime:       PHP 8.1.2
Configuration: <my path>\phpunit.xml
Unexpected: test 'testAbc' has started (but was not listed in Test Window)
Unexpected: test 'testAbc' has passed (but was not listed in Test Window)
Unexpected: test 'testGhi' has started (but was not listed in Test Window)
Unexpected: test 'testGhi' has passed (but was not listed in Test Window)
Environment Values
Extension version v4.12.0
Operating system Windows 11
PHPUnit 10.5.2
VSCode 1.84.2

phpunit.args with docker commands

Hi @elonmallin I can't seem to get the phpunit config to get loaded when running the tests via docker-compose commands. Is there any workaround. It seems to ignore my values from phpunit.args

Tests no longer running?

Hi,

All of a sudden it looks like tests are no longer running. Is there anything I can do to debug what is happening.

Am I the only one facing problems?
Hope you can help, love the zero config on your extension!

EDIT: I checked the Output window for the extension and it shows nothing, Also checked the Log(Extension Host) filter but also nothing for this extension.

Regards Gijs

Nothing is printed on the output console

Hi,
I'm running on Windows 10 and configured the extension as suggested, e.g. execPath is pointing where it should be...
But when I run phpunit command no tests are run.

You can see from the screenshot below that the exact command works on the build-in command line.

phpunit

Anyone else with Win10 having this issue?

No output from PHPUnit

Hi,

I'm trying to use this for my CakePHP project.

My config looks like this:

{
    "phpunit.execPath": "C:\\wamp\\bin\\php\\php5.5.12\\php.exe vendor\\phpunit\\phpunit\\phpunit",
    "phpunit.args": []
}

When I try to run a test, the output panel in VSCode has the following added to it:

C:\wamp\bin\php\php5.5.12\php.exe vendor\phpunit\phpunit\phpunit --filter testCannotViewCircleWithEmptyUserId ./tests/TestCase/Controller/CalendarControllerTest.php

Then nothing further is outputted. If I open Command Prompt in my project directory and run the same command my tests run.

I've seen the other similar issues and tried what they suggested but still have this issue. (I restarted VSCode without any change, and I can't use phpunit.bat because that applies to the PHPUnit supplied with xampp, but not the one supplied with CakePHP.

Help would be greatly appreciated, thanks!

Run test nearest including the immediate class.

Kudos to this really helpful extension.

Quite often while testing and TDD in general we use test the nearest cmd+shift+p and you get the options PHPUnit Test Nearest.

Thanks to the feature this extension provides. It saves a ton of time.

However it fails to test when it comes to the class level. Also note that the methods are only recognised only when the method scope is public.

The failure to pick the immediate class is resolved in the PR #38

Not working, no error

Hi,

I installed PHPUnit, added this to my config file :

    "phpunit.php": "E:\\easyPhp\\eds-binaries\\php\\php713vc14x86x181021165540\\php.exe",
    "phpunit.phpunit": "E:\\dev\\third-party-libs\\PHPUnit\\phpunit-7.4.3.phar",
    "phpunit.args": [
        "--configuration",
        "./phpunit.xml.dist"
    ]

I created a test class :

<?php

namespace wcf\data\siraca\participation;

// use PHPUnit\Framework\TestCase;

class ParticipationOrganizerTest extends \PHPUnit_Framework_TestCase
{
    public function testTest()
    {
        $this->assertTrue(true);
    }
}

I select the method, CTRL+SHIFT+P, execute command PHPUnit Test... and nothing happens, no error, no console output...

Did I miss something ?

When phpunit.args is used, it is doubled for every repeating of the last test

Repro

  1. Add some argument in config, e.g.
	"phpunit.args": [
		"--testdox"
	],
  1. Run a test
    The command is: Executing task: /some/path/vendor/bin/phpunit' --testdox --colors=always '/some/path'
  2. Execute Rerun last test
    The command now is: Executing task: /some/path/vendor/bin/phpunit' --testdox --colors=always --testdox --colors=always '/some/path'
  3. Execute Rerun last test again. --testdox --colors=always are added again.

Expected outcome

The arguments for color and testdox to not be appended every time.

Environment Values
Extension version 4.1.1
Operating system Windows 10

I really enjoy using your extension!
Would you mind if I PR'd this?

"Run build task" not works after installing the plugin.

Hi,
Thanks for creating great plugin. I have a question.
After I installed the plugin, I cannot perform the "run build task" command in my vscode anymore, it's just fetching constantly as shown in picture:
image
Can you please check?

Here is my vscode info:
Version: 1.77.3
Commit: 704ed70d4fd1c6bd6342c436f1ede30d1cff4710
Date: 2023-04-12T09:19:37.325Z (3 wks ago)
Electron: 19.1.11
Chromium: 102.0.5005.196
Node.js: 16.14.2
V8: 10.2.154.26-electron.0
OS: Darwin x64 21.6.0
Sandboxed: Yes

Thanks,
Q.

Feature suggestions

First of all thank you for this package, it looks very promising.

Currently i'm a ST3 user, and i use a package for phpunit. It has great features like running the nearest test, running the whole file, all the tests or the last test ran. It also has a nice way of discovering the phpunit executable if you have the composer option enabled, so you don't have to make a specific configuration for each specific project. You could use some features that the sublime text package has to improve or make this one more robust.

Error on run tests in directory with spaces in name

Hi, i think that the title is self explained about the problem that i´m was talking.
The error occour when use "F1" and select "PHPUnit Test" in a directory with spaces on the name.

Well... i´m opened the plugin source code and spend an hour in debug and i guess that i´ve found how to resolve this issue:

I think that this will resolve this case.
:)

In phpunittest.ts file, inside function resolveContextArgs, before return args;

 public async resolveContextArgs(type: RunType, config): Promise<string[]> {

...


  if (args.length > 0) {            // new 
    args[0] = "'" + args[0] + "'";  // new
  }                                 // new

  return args;
}

only output, no real running of a test

   ./vendor/phpunit/phpunit/phpunit --configuration ./tests/phpunit_all.xml 
   c:\Data\git\ANGEL\tests\Unit\Modules\Frontend\Controllers\CountryControllerTest.php

is shown in the output, but it won't run.

When I copy and paste it into the terminal window, it still won't run.

I have to add php before it to make it run.

So I did that in the configuration, and now I see that in the output window, but it still doesn't fire anything in the terminal window. How can I solve it?

phpunit 2.1.1 with code 1.18.1 memory leak?

Hi,
I'm creating a mirror issue related to: microsoft/vscode#39478

  • VSCode Version: Code 1.18.1 (929bacba01ef658b873545e26034d1a8067445e9, 2017-11-16T18:32:36.023Z)
  • OS Version: Windows_NT x64 10.0.15063
  • Extensions:
Extension Author (truncated) Version
azuretoolsforvscode bra 1.3.0
xml Dot 1.9.2
phpunit ema 2.1.1
php-debug fel 1.12.1
crane Hvy 0.3.8
azure-functions-tools joh 0.3.1
format-indent Kas 1.3.0
vscode-gutter-preview kis 0.12.2
start-git-bash McC 1.2.1
mssql ms- 1.2.1
PowerShell ms- 1.5.1
azurerm-vscode-tools msa 0.3.7
okazukiplantuml oka 0.2.2
emoji Per 0.0.3
vscode-docker Pet 0.0.22

Steps to Reproduce:

  1. Open Code with a php project containing tests.
  2. Go to terminal: (powershell is default).
  3. Change to /tests folder, Launch phpunit
  4. Some results show (on approx. 3 pages).
  5. Scroll back and forth in the window
  6. Eventually window freezes and memory usage goes up and down from 300MB to 3.5GB. Processor is at 25%.

Reproduces without extensions: No

I'm assuming the phpunit extension v2.1.1 has a problem.
My assumption is based on the fact that I also tried doing just "ls" (with extensions on) and scrolling back and forth and the problem does not manifest itself.
Please let me know if you need more info....

Regards,
Profidocs

Problems not identified in string-comparison errors on PHPUnit 5.7

For my sins, I'm using an older version of PHPUnit. I've noticed that problems aren't always picked up.

Repo - working case

This output marks a problem correctly:

PHPUnit 5.7.27 by Sebastian Bergmann and contributors.

...F..........                                                    14 / 14 (100%)

Time: 652 ms, Memory: 8.00MB

There was 1 failure:

1) SilverStripe\Config\Tests\Transformer\YamlTransformerTest::testNoNameStatement
Failed asserting that false is true.

/Users/samminnee/Projects/silverstripe-config/tests/Transformer/YamlTransformerTest.php:183

FAILURES!
Tests: 14, Assertions: 23, Failures: 1.

Generating code coverage report in Clover XML format ... done
The terminal process "/bin/bash '-c', ''/Users/samminnee/Projects/silverstripe-config/vendor/bin/phpunit' --colors=always '/Users/samminnee/Projects/silverstripe-config/tests/Transformer/YamlTransformerTest.php''" terminated with exit code: 1.

Terminal will be reused by tasks, press any key to close it.

Outcome

The failure is linked as a problem

Repo - broken case

But this output does not:

> Executing task: '/Users/samminnee/Projects/silverstripe-config/vendor/bin/phpunit' --colors=always '/Users/samminnee/Projects/silverstripe-config/tests/Transformer/YamlTransformerTest.php' <

PHPUnit 5.7.27 by Sebastian Bergmann and contributors.

...F..........                                                    14 / 14 (100%)

Time: 734 ms, Memory: 8.00MB

There was 1 failure:

1) SilverStripe\Config\Tests\Transformer\YamlTransformerTest::testNoNameStatement
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'blahy'
+'blah'

/Users/samminnee/Projects/silverstripe-config/tests/Transformer/YamlTransformerTest.php:184

FAILURES!
Tests: 14, Assertions: 23, Failures: 1.

Generating code coverage report in Clover XML format ... done
The terminal process "/bin/bash '-c', ''/Users/samminnee/Projects/silverstripe-config/vendor/bin/phpunit' --colors=always '/Users/samminnee/Projects/silverstripe-config/tests/Transformer/YamlTransformerTest.php''" terminated with exit code: 1.

Terminal will be reused by tasks, press any key to close it.

Outcome

No problems are linked

Expected outcome

The failure is linked as a problem

Able to add keybindings

In VS code i want to be able to add a key binding for running the tests without having to type it in every time

// Place your key bindings in this file to overwrite the defaults [ { "key": "ctrl+f8", "command": "phpunit", "when": "editorTextFocus" }]

I tried that but it does not work. How would i do it?

After update to vscode 1.5.1 the path of file tested is wrong

On Linux trying to launch phpunit on specific file fails because of phpunit is launched with wrong path.

For example trying to test ./plugins/tests/test.php inside myproject folder

vendor/bin/phpunit .plugins/tests/test.php
Cannot open file ".plugins/tests/test.php".

It miss / after . i.e. ./plugins/tests/test.php.

It worked well until 1.5 release.

phpunit.phpunit setting seems to have no effect

I tried setting a custom PHPUnit path like this in my workspace settings (.vscode/settings.json file in the root of my project):

"phpunit.phpunit": "docker exec -it MY_CONTAINER_NAME php vendor/bin/phpunit"

However, the PHPUnit extension doesn’t seem to be using this path, as the tests fail instantly with this header output:

Running phpunit with driver: Composer
./vendor/bin/phpunit ./tests/unit/Domain/Report/Model/CategoryTest.php --filter testCanCreateTopLevelCategory --no-logging
PHPUnit 7.5.2 by Sebastian Bergmann and contributors.

The second line looks like the extension is still trying to run PHPUnit locally from my machine, using the path ./vendor/bin/phpunit.

Is there anything else I need to configure to get this working with my Docker container? As it also says driver: Composer, so not sure if that needs configuring somewhere?

./vendor/phpunit/phpunit/phpunit not recognized as php on Windows

Operating system: Windows 10
PHPUnit version: 8.0.6

Whenever I run a test, I receive the following response from the terminal:

> Executing task:  c:/path/to/project/vendor/phpunit/phpunit/phpunit c:/path/to/project/tests/Unit/UnitTest.php --filter testExample <

'c:/path/to/project/vendor/phpunit/phpunit/phpunit' is not recognized as an internal or external command,
operable program or batch file.
The terminal process terminated with exit code: 1

Terminal will be reused by tasks, press any key to close it.

Running the Executing task command prepended with php works, the terminal doesn't seem to recognize the file as being PHP.

Executing task fails with nushell set as default shell

I have Nushell set as my default shell in VS Code on Windows. When I run a test, I see the following:

 *  Executing task: phpunit.bat --colors=always 'c:/Users/Charles/Dev/Exercism/php/hamming/HammingTest.php' 

Error: 
  × The system cannot find the file specified. (os error 2)


 *  The terminal process "C:\Users\Charles\scoop\shims\nu.exe /d /c phpunit.bat --colors=always 'c:/Users/Charles/Dev/Exercism/php/hamming/HammingTest.php'" terminated with exit code: 1. 
 *  Terminal will be reused by tasks, press any key to close it. 

If I manually run the following command, it works:

cmd.exe /d /c phpunit.bat --colors=always 'c:/Users/Charles/Dev/Exercism/php/hamming/HammingTest.php'

The extension works fine if I have Command Prompt, PowerShell, or Git Bash set as my default. Would it be be possible to force use of cmd.exe or detect if nushell is default?

The following commands work:

Executes and keeps nu running:

C:\Users\Charles\scoop\shims\nu.exe --execute 'phpunit.bat --colors=always "c:/Users/Charles/Dev/Exercism/php/hamming/HammingTest.php"'

Executes and exits nu after finished running:

C:\Users\Charles\scoop\shims\nu.exe --commands 'phpunit.bat --colors=always "c:/Users/Charles/Dev/Exercism/php/hamming/HammingTest.php"'

Note, I don't need the full path to nu.exe in the because I have it on my PATH.

Option "--color=always" is added recursivelly at console output at each "rerun last test'

After the v4.1.0 the --colors=always option started to be default. At my config I used to use the phpunit.colors config setted as --colors=always without problems. Now, every time that I rerun some phpunit test one more "--color-always" is added to the console output.

Repro

  1. Set the config phpunit.colors with the value --colors=always
  2. Run any test
  3. Use the command to rerun last test

Outcome

  1. Check that every time you rerun any test one more "--colors=always" is added to your console output

Expected outcome

The console shouldn't modify its output, like it was at previous versions. You can fix it by removing the --color-always setted in your phpunit.colors config (I just did it and works well)

Logs / output / settings

console-output

settings.json

"phpunit.command": "docker-compose exec php",
"phpunit.phpunit": "vendor/bin/phpunit",
"phpunit.paths": {
  "${workspaceFolder}": "/var/www/app"
}

Just an observation: I use the extension with docker

Environment Values
Extension version v4.1.0
Operating system Ubuntu 18.04

Spaces in file path in windows 10

Hello,

I saw there is already an issue concerning spaces in the path for the resource file but I am having this issue too. Is there a way I would be able to configure this correctly?
This here is the output when I try to execute a test

> Executing task in folder html: php c:/Users/Stefan Name/Documents/test/phpunit.phar "c:/Users/Stefan Name/Documents/test/test.php" --filter test1 <


Could not open input file: c:/Users/Stefan
The terminal process terminated with exit code: 1

Any ideas how to solve this?

Thank you very much and best regards,
Stefan

Failed to create terminal for task when running automatic tasks

  • VSCode Version: 1.32.3
  • OS Version: macOS Mojave 10.14.3

Steps to Reproduce:

Automatic tasks seem to interfere with extensions that need to run tasks.

I use a PHPUnit extension (https://github.com/elonmallin/vscode-phpunit) and I find that whenever I launch a workspace that runs automatic tasks, the phpunit commands fail with an error message saying Failed to create terminal for task phpunit: run.

Turning off the automatic tasks seems to fix the issue.

FYI I also reported this in the vscode repo (microsoft/vscode#70904) because I'm not sure if the issue is with the vscode host or the plugin.

Does this issue occur when all extensions are disabled?: Yes/No
No

'PHPUnit Rerun Last Test' keep adding extra '--colors=always' argument

Run command PHPUnit Rerun Last Test, each time I use this command, it add another extra --colors=always argument

Outcome

Executing task: php 'path/my_project/vendor/phpunit/phpunit/phpunit' --colors=always --colors=always --colors=always --colors=always 'path/my_project/tests/Unit/MyTest.php' --filter test_function

Expected outcome

Executing task: php 'path/my_project/vendor/phpunit/phpunit/phpunit' --colors=always 'path/my_project/tests/Unit/MyTest.php' --filter test_function
(single --colors=always only)

Logs / output / settings

Executing task: php 'path/my_project/vendor/phpunit/phpunit/phpunit' --colors=always --colors=always --colors=always --colors=always 'path/my_project/tests/Unit/MyTest.php' --filter test_function

Environment Values
Extension version 4.1.1
Operating system Windows 11

Wrong php version used

When I run the extension, it uses php located at 'usr/bin/php' instead of 'usr/local/bin/php'.
This causes an error, because phpunit requires a more recent version of php.
I have tried to set the php path explicitly using "phpunit.php": "/usr/local/bin/php",, but it has no effect, and still uses the one at 'usr/bin/php'

Problem configuring path to phpunit.xml

I have a project where i have 2 php libraries with their own sets of tests. I have different phpunit.xml files for them, located in the parent folder of each test suite.

Is there a variable I can use, to point to the phpunit.xml file using a path relative to the test suite? Something like this :

    "phpunit.args": [
        "--configuration", "${testSuite}/../phpunit.xml"
    ]

Add the ability to run tests from the source code files

First off, this is an excellent extension. I love how easy it is to run individual tests via cmd + shift + P.

There is a feature in the Golang extension which I feel would be great to incorporate into this extension to make running tests even easier. Specifically, there is a code lens that enables you to run tests right from the source code files as show in the image below:

screen shot 2017-11-12 at 8 31 13 am

I'm not positive, but it seems that the code at https://github.com/Microsoft/vscode-go/blob/master/src/goRunTestCodelens.ts is where the magic happens in the Golang extension. Anyways, I thought it would be worth posting here for feedback as to whether this would be useful, and if so, possible to implement in this extension.

No output

phpunit command produces only this output
phpunit --filter testListUsers ./tests/AppBundle/Controller/UserControllerTest.php

Without any additional information.

Config project/.vscode/settings.json

{
    "phpunit.execPath": "./vendor/bin/",
    "phpunit.args": [
        "--configuration", "./phpunit.xml.dist"
    ]
}

Even if i replace relative path with full path same result.

PHPUnit cannot launch phpunit on Windows

Repro

  1. install PHPUnit extension for VScode
  2. create new directory
  3. composer require phpunit/phpunit
  4. set up phpunit.xml in project directory, see below
  5. create some sample test
  6. run "vendor/bin/phpunit" in the build in terminal
  7. enjoy phpunit's result displayed in the terminal
  8. CTRL+SHIFT+P and PHPUnit Test

Outcome

> Executing task: php 'c:/PATH_TO_PROJECT_DIRECTORY/vendor/phpunit/phpunit/phpunit' --colors=always 'c:/PATH_TO_PROJECT_DIRECTORY/tests/unit/SampleTest.php' --filter public <

Could not open input file: 'c:/Users/olaf/workspace/phpunit_example/vendor/phpunit/phpunit/phpunit'
The terminal process "C:\WINDOWS\System32\cmd.exe /d /c php 'c:/Users/olaf/workspace/phpunit_example/vendor/phpunit/phpunit/phpunit' --colors=always 'c:/Users/olaf/workspace/phpunit_example/tests/unit/SampleTest.php' --filter public" terminated with exit code: 1.

Terminal will be reused by tasks, press any key to close it.

Expected outcome

Unit tests should be run as when invoked from terminal's command line.

Suspected error

The single quotes around the executable and the file name seem to be interpreted as part of the filename.

When I run php "c:/PATH_TO_PROJECT_DIRECTORY/vendor/phpunit/phpunit/phpunit" --colors=always "c:/PATH_TO_PROJECT_DIRECTORY/tests/unit/SampleTest.php" --filter public - i.e. with double quotes to delimit the file names- phpunit is invoked as expected.

Logs / output / settings

Environment

  • Windows 10
  • PHPUnit 9.4.0 by Sebastian Bergmann and contributors.
  • Runtime: PHP 7.4.3

phpunit.xml

<?xml version="1.0" encoding="UTF-8"?>
<phpunit
    bootstrap="vendor/autoload.php"
    colors="true"
    verbose="true"
    stopOnFailure="true">
    <testsuites>
        <testsuite name="Test suite">
            <directory>tests</directory>
        </testsuite>
    </testsuites>
</phpunit>

Spaces in configuration file path Test Suite - Win 10

Related issue #37 (Spaces in file path in windows 10)

Seems the above issue was fixed for running the phpunit command initially, however the configuration phpunit.xml file is encountering the same issue, as can been seen in the log output, the configuration file is not enclosed with quotes.

Running individual tests with files open does work properly.

Repro

Run Test Suite in a project in Windows 10 that has a space in the absolute file path.

Outcome

The test suite does prompt to choose which tests to initially run;

image

however after selecting any option, the error below shows and the test fails to run.

Expected outcome

The test should run successfully

Logs / output / settings

> Executing task: php 'c:/Users/{user}/Documents/GIT/Path/To Foo/Bar/vendor/phpunit/phpunit/phpunit' --colors=always --colors=always --colors=always -c c:/Users/{user}/Documents/GIT/Path/To Foo/Bar/phpunit.xml <

PHPUnit 9.2.5 by Sebastian Bergmann and contributors.

Cannot open file "Foo/Bar".
The terminal process terminated with exit code: 1

Terminal will be reused by tasks, press any key to close it.
Environment Values
Extension version 4.1.0
Operating system Windows 10

Release new version

HI @elonmallin !

Could you please cut a release of this extension? I would like to use envVars but it is not available in the most recent version on the marketplace.

Thanks in advance 🙇

Code Lens call config file multiple times

Repro

  1. Run test with code lens
  2. Re run same test with code lens

Outcome

'testAthenticatedUserCanIndex' --configuration=api-rest/phpunit.xml --configuration=api-rest/phpunit.xml...

Expected outcome

'testAthenticatedUserCanIndex' --configuration=api-rest/phpunit.xml...

| Extension version | 4.16.1 |
| Operating system | Mac OS 12.6.7 |

No colors

Not sure if this is a vscode issue or not, but when you enable colours with --colors=always phpunit option, there is no colours displayed in the vscode window - is this because it's being output to the debug console view rather than run in a terminal window?

image

CodeLens does not work if method parameters contain PHP8 features

Repro

Create a test method that has argument type hint in the form of array|(ArrayAccess&Countable&Traversable) $parentVisibleToRoles,

Outcome

There is no "Run test" link over the method name.

Expected outcome

A "Run test" link

Logs / output / settings

It appears that the php-parser library does not support PHP 8 features.

Environment Values
Extension version 4.16.1
Operating system Windows 11 23H2

extension add extra wrong -f flag if use paratest

Repro

  1. add option "phpunit.phpunit": "vendor/bin/paratest" to settings

Outcome

php vendor/bin/paratest --testsuite=suite --configuration=phpunit.xml --filter=^.::(className)( with data set .)?$ className.php --colors=never --teamcity -f

**The "-f" option does not exist. **

Without "phpunit.phpunit": "vendor/bin/paratest" on settings doesn't add -f flag

Expected outcome

Execute test

Not working at all,

Hello,

I am running ubuntu 14.04,

And have followed the documentation to install it and used the two example files php unit has,

But it not running any tests.

All i get is this in the output
/usr/local/bin/phpunit --configuration ./phpunit.xml.dist ./tests/MoneyTest.php This version of PHPUnit requires PHP 5.6; using the latest version of PHP is highly recommended.

Any help?

Please let me know if you need any information.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.