chilio / laravel-dusk-ci

Docker Test suite for Laravel Dusk in gitlab CI
MIT License
159 stars 51 forks source link

use local phpunit #48

Closed lorvent closed 5 years ago

lorvent commented 5 years ago

hi chilio,

i guess it is better to use local phpunit instead of pulling it from server https://github.com/chilio/laravel-dusk-ci/blob/7e94f17fb27fc1e8183d5bedf3686ad1970d594e/Dockerfile#L77-L79

because when i try to use this in laravel 5.6 or low where we need to use phpunit 4, i am getting error like

https://github.com/laravel/framework/issues/26874

and i assume, the error is because of using latest version of phpunit.

thanks

chilio commented 5 years ago

Hi @lorvent, to use local phpunit you can always issue in script: - ./vendor/phpunit/phpunit/phpunit -v --coverage-text --colors --stderr instead of - phpunit -v --coverage-text --colors --stderr I believe available system newest phpunit brings more elasticity to testing...

lorvent commented 5 years ago

no, when we run "php artisan dusk" it takes global phpunit automatically

chilio commented 5 years ago

@lorvent do you have phpunit.xml properly set? Please post your settings...

lorvent commented 5 years ago

yes, as per example files provided in repo.

below code refers to phpunit.xml

<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
         backupStaticAttributes="false"
         bootstrap="vendor/autoload.php"
         colors="true"
         convertErrorsToExceptions="true"
         convertNoticesToExceptions="true"
         convertWarningsToExceptions="true"
         processIsolation="false"
         stopOnFailure="false">
    <testsuites>
        <testsuite name="Unit">
            <directory suffix="Test.php">./tests/Unit</directory>
        </testsuite>

        <testsuite name="Feature">
            <directory suffix="Test.php">./tests/Feature</directory>
        </testsuite>
    </testsuites>
    <filter>
        <whitelist processUncoveredFilesFromWhitelist="true">
            <directory suffix=".php">./app</directory>
        </whitelist>
    </filter>
    <php>
        <server name="APP_ENV" value="testing"/>
        <server name="BCRYPT_ROUNDS" value="4"/>
        <server name="CACHE_DRIVER" value="array"/>
        <server name="MAIL_DRIVER" value="array"/>
        <server name="QUEUE_CONNECTION" value="sync"/>
        <server name="SESSION_DRIVER" value="array"/>
    </php>
</phpunit>

and below for phpunit.dusk.xml

<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
         backupStaticAttributes="false"
         bootstrap="vendor/autoload.php"
         colors="true"
         convertErrorsToExceptions="true"
         convertNoticesToExceptions="true"
         convertWarningsToExceptions="true"
         processIsolation="false"
         stopOnFailure="false">
    <testsuites>
        <testsuite name="Browser Test Suite">
            <directory suffix="Test.php">./tests/Browser</directory>
        </testsuite>
    </testsuites>
    <filter>
        <whitelist processUncoveredFilesFromWhitelist="true">
            <directory suffix=".php">./app</directory>
        </whitelist>
    </filter>
</phpunit>
chilio commented 5 years ago

Hi @lorvent, unfortunately, your error must be caused by something else.

I can confirm that using the syntax as in examples, enforces phpunit (and dusk itself) running with phpunit version from project (NOT GLOBAL).

BTW. From the link you've provided, I see that there are multiple different problems to this kind of similar errors. It is hard to tell without the whole code base of course. However what I would suspect in the first place, and what I could suggest is checking, if all additional packages are properly installed ( especially providers registration - order, duplication, aliases etc.). It is just only a hunch though. Good luck...