hoaproject / Test

The Hoa\Test library.
https://hoa-project.net/
11 stars 10 forks source link

Cannot run tests on Windows using Git Bash #83

Closed lukbukkit closed 7 years ago

lukbukkit commented 7 years ago

Hello, I wanted to run the tests for the Socket Libary on Windows, but when I execute the command, I get only a single line of output:

$ vendor/bin/hoa test:run
> atoum path: D:\lukas\Coding\PhpstormProjects\Hoaproject\Acl\vendor\atoum\atoum\D:\lukas\Coding\PhpstormProjects\Hoaproject\Acl\vendor\bin\/../atoum/atoum/bin/atoum

After this, the programms just waits for termination. I tested it on Ubuntu too and there it works.

My PHP version by the way:

$ php --version
PHP 7.0.8 (cli) (built: Jun 21 2016 15:27:20) ( ZTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies

Thank you for your help!

Hywan commented 7 years ago

Hello @LukBukkit,

Please, can you test #84 and tell me if it fixes your issue? Thanks!

Hywan commented 7 years ago

The patch in atoum/atoum#688 will only fix the “atoum path” line in the report. The path is incorrectly displayed, but it is correctly used.

lukbukkit commented 7 years ago

I've applied #84 and atoum/atoum#688, but it doesn't seem to help.

Hywan commented 7 years ago

What is the output please?

lukbukkit commented 7 years ago

Again a single line of output:

$ vendor/bin/hoa test:run
> atoum path: D:\lukas\Coding\PhpstormProjects\Hoaproject\Socket\vendor\atoum\atoum\bin\atoum

I will try it also on another windows machine. // Edit I tried to run the tests on a fresh installed Windows 10 machine with only PHP 7.0.16 and the Git Bash installed, but the error was same as mine, so it has to be a general Windows problem. I'll try to dig through the code too.

Hywan commented 7 years ago

Can you var_dump($command) here https://github.com/hoaproject/Test/blob/master/Bin/Run.php#L334, and give me the result please?

lukbukkit commented 7 years ago

Sure

$ vendor/bin/hoa test:run
string(329) "D:\lukas\Coding\PhpstormProjects\Hoaproject\Socket\vendor\bin\atoum --autoloader-file D:\lukas\Coding\PhpstormProjects\Hoaproject\Socket\vendor\hoa\test\.autoloader.atoum.php --configurations D:\lukas\Coding\PhpstormProjects\Hoaproject\Socket\vendor\hoa\test\.atoum.php --force-terminal --max-children-number 2 --directories Test"
> atoum path: D:\lukas\Coding\PhpstormProjects\Hoaproject\Socket\vendor\atoum\atoum\bin\atoum
Hywan commented 7 years ago

@LukBukkit What happens when you execute this command manually, directly on the command-line?

lukbukkit commented 7 years ago

Okay when I try to run the command using the Windows command-line it works. If I change the paths a litte bit the command looks like this

vendor/bin/atoum --autoloader-file vendor/hoa/test/.autoloader.atoum.php --configurations vendor/hoa/test/.atoum.php --force-terminal --max-children-number 2 --directories Test/

and works in the Git Bash too. When I run test:run using the Windows cmd, I have the same problem as before:

D:\lukas\Coding\PhpstormProjects\Hoaproject\Socket>vendor\bin\hoa.bat test:run
string(329) "D:\lukas\Coding\PhpstormProjects\Hoaproject\Socket\vendor\bin\atoum --autoloader-file D:\lukas\Coding\PhpstormProjects\Hoaproject\Socket\vendor\hoa\test\.autoloader.atoum.php --configurations D:\lukas\Coding\PhpstormProjects\Hoaproject\Socket\vendor\hoa\test\.atoum.php --force-terminal --max-children-number 2 --directories Test"
> atoum path: D:\lukas\Coding\PhpstormProjects\Hoaproject\Socket\vendor\atoum\atoum\bin\atoum
^CBatchvorgang abbrechen (J/N)? J

Again thanks you for your help to this point. Now I've got a workaround. 😃

Hywan commented 7 years ago

But it seems we have an issue on Windows with Hoa\Console\Processus then… OK :-].

Can you test those two examples and tell me which one works or not.

Example 1:

$processus = new Hoa\Console\Processus('ls');
$processus->open();
echo $processus->readAll();

Example 2:

$processus = new Hoa\Console\Processus('ls');
$processus->on('output', function (Hoa\Event\Bucket $bucket) {
    $data = $bucket->getData();
    echo '> ', $data['line'], "\n";
});
$processus->run();

Thanks!

lukbukkit commented 7 years ago

Test Nr.1:

CHANGELOG.md
Client.php
Connection
Exception
Node.php
Processus.php
README.md
Server.php
Socket.php
Test
Transport.php
composer.json
composer.lock
test.sh
vendor

Test Nr.2:

PHP Warning:  Invalid argument supplied for foreach() in D:\lukas\Coding\PhpstormProjects\Hoaproject\Socket\vendor\hoa\console\Processus.php on line 460

Warning: Invalid argument supplied for foreach() in D:\lukas\Coding\PhpstormProjects\Hoaproject\Socket\vendor\hoa\console\Processus.php on line 460
Hywan commented 7 years ago

@LukBukkit This is an issue related to Hoa\Console. Please, go to https://github.com/hoaproject/Console/issues/79 for the sequel.