e107inc / e107-test

For developmental use with e107 v2.
2 stars 2 forks source link

Configuration/Paths on Windows with PHPStorm #1

Closed CaMer0n closed 6 years ago

CaMer0n commented 6 years ago

hi @Deltik,

It looks awesome! I think I almost got it working with PHPStorm.

Here's the thing.. currently my working setup is like this:

Tests: D:\Documents\UniServerZ\www\e107v2\phpunit\ (this repo)
 e107: D:\Documents\UniServerZ\www\e107v2\ (e107 repo) 

I believe your idea, when applied to my situation is to have something like this:

Tests: D:\Documents\UniServerZ\www\phpunit\ (this repo) 
 e107: D:\Documents\UniServerZ\www\phpunit\e107v2\ (e107 repo) 

But if I were to try to keep my current setup, do you know how I might go about configuring it? ie. to keep the testing scripts in phpunit a subfolder of e107v2 ?

Needless to say, I'd like to disable 'cPanel' deployment when running locally on Windows.

Using "RUN" in PHPStorm:

D:\Documents\UniServerZ\core\php71\php.exe C:/Users/Wiz/AppData/Local/Temp/ide-codeception.php run --report -o "reporters: report: PhpStorm_Codeception_ReportPrinter" --no-ansi --no-interaction -c D:\Documents\UniServerZ\www\e107v2\phpunit\codeception.yml
Testing started at 3:08 PM ...
Codeception PHP Testing Framework v2.3.7
Powered by PHPUnit 6.4.4 by Sebastian Bergmann and contributors.

Warning: include_once(D:\Documents\UniServerZ\www\e107v2\phpunit\lib\deployers\..\cpaneluapi/cpaneluapi.class.php): failed to open stream: No such file or directory in D:\Documents\UniServerZ\www\e107v2\phpunit\lib\deployers\cpanel_deployer.php on line 3

Warning: include_once(): Failed opening 'D:\Documents\UniServerZ\www\e107v2\phpunit\lib\deployers\..\cpaneluapi/cpaneluapi.class.php' for inclusion (include_path='.;C:\php\pear') in D:\Documents\UniServerZ\www\e107v2\phpunit\lib\deployers\cpanel_deployer.php on line 3

Fatal error: Uncaught Error: Class 'cpanelAPI' not found in D:\Documents\UniServerZ\www\e107v2\phpunit\lib\deployers\cpanel_deployer.php:118
Stack trace:
#0 D:\Documents\UniServerZ\www\e107v2\phpunit\lib\deployers\cpanel_deployer.php(69): cPanelDeployer->prepare()
#1 D:\Documents\UniServerZ\www\e107v2\phpunit\tests\_support\Helper\Base.php(17): cPanelDeployer->start(Array)
#2 D:\Documents\UniServerZ\www\e107v2\phpunit\tests\_support\Helper\E107Base.php(14): Helper\Base->_beforeSuite(Array)
#3 phar://D:/Documents/UniServerZ/www/e107v2/phpunit/codecept.phar/src/Codeception/Subscriber/Module.php(38): Helper\E107Base->_beforeSuite(Array)
#4 [internal function]: Codeception\Subscriber\Module->beforeSuite(Object(Codeception\Event\SuiteEvent), 'suite.before', Object(Symfony\Component\EventDispatcher\EventDispatcher))
#5 phar://D:/Documents/UniServerZ/www/e107v2/phpunit/codecept.phar/vendor/symfony/event-dispatcher/EventDispatcher.php(212): call_user_func(Array, Object(Codeception\Event\SuiteEvent), 'suite.before', Object(Symfony in D:\Documents\UniServerZ\www\e107v2\phpunit\lib\deployers\cpanel_deployer.php on line 118

FATAL ERROR. TESTS NOT FINISHED.
Uncaught Error: Class 'cpanelAPI' not found in D:\Documents\UniServerZ\www\e107v2\phpunit\lib\deployers\cpanel_deployer.php:118
Stack trace:
#0 D:\Documents\UniServerZ\www\e107v2\phpunit\lib\deployers\cpanel_deployer.php(69): cPanelDeployer->prepare()
#1 D:\Documents\UniServerZ\www\e107v2\phpunit\tests\_support\Helper\Base.php(17): cPanelDeployer->start(Array)
#2 D:\Documents\UniServerZ\www\e107v2\phpunit\tests\_support\Helper\E107Base.php(14): Helper\Base->_beforeSuite(Array)
#3 phar://D:/Documents/UniServerZ/www/e107v2/phpunit/codecept.phar/src/Codeception/Subscriber/Module.php(38): Helper\E107Base->_beforeSuite(Array)
#4 [internal function]: Codeception\Subscriber\Module->beforeSuite(Object(Codeception\Event\SuiteEvent), 'suite.before', Object(Symfony\Component\EventDispatcher\EventDispatcher))
#5 phar://D:/Documents/UniServerZ/www/e107v2/phpunit/codecept.phar/vendor/symfony/event-dispatcher/EventDispatcher.php(212): call_user_func(Array, Object(Codeception\Event\SuiteEvent), 'suite.before', Object(Symfony 
in D:\Documents\UniServerZ\www\e107v2\phpunit\lib\deployers\cpanel_deployer.php:118

Process finished with exit code 255

image

And here's the result if I remove the "Custom Working Directory" value from the panel above:

D:\Documents\UniServerZ\core\php71\php.exe C:/Users/Wiz/AppData/Local/Temp/ide-codeception.php run --report -o "reporters: report: PhpStorm_Codeception_ReportPrinter" --no-ansi --no-interaction -c D:\Documents\UniServerZ\www\e107v2\phpunit\codeception.yml
Testing started at 3:43 PM ...

==== Redirecting to Composer-installed version in vendor/codeception ====
Codeception PHP Testing Framework v2.3.8
Powered by PHPUnit 6.5.6 by Sebastian Bergmann and contributors.

Warning: include_once(D:\Documents\UniServerZ\www\e107v2\phpunit\lib\deployers/../cpaneluapi/cpaneluapi.class.php): failed to open stream: No such file or directory in D:\Documents\UniServerZ\www\e107v2\phpunit\lib\deployers\cpanel_deployer.php on line 3

Warning: include_once(): Failed opening 'D:\Documents\UniServerZ\www\e107v2\phpunit\lib\deployers/../cpaneluapi/cpaneluapi.class.php' for inclusion (include_path='.;C:\php\pear') in D:\Documents\UniServerZ\www\e107v2\phpunit\lib\deployers\cpanel_deployer.php on line 3
'mysql' is not recognized as an internal or external command,
operable program or batch file.

Fatal error: Uncaught RuntimeException: Command Did Not Finish Properly in D:\Documents\UniServerZ\www\e107v2\phpunit\vendor\codeception\codeception\src\Codeception\Subscriber\ErrorHandler.php:101
Stack trace:
#0 [internal function]: Codeception\Subscriber\ErrorHandler->shutdownHandler()
In DbPopulator.php line 90:
#1 {main}

  thrown in D:\Documents\UniServerZ\www\e107v2\phpunit\vendor\codeception\codeception\src\Codeception\Subscriber\ErrorHandler.php on line 101
  The populator command did not end successfully:   
    Exit code: 1                                    
    Output:                                         

run [-o|--override OVERRIDE] [-e|--ext EXT] [--report] [--html [HTML]] [--xml [XML]] [--tap [TAP]] [--json [JSON]] [--colors] [--no-colors] [--silent] [--steps] [-d|--debug] [--coverage [COVERAGE]] [--coverage-html [COVERAGE-HTML]] [--coverage-xml [COVERAGE-XML]] [--coverage-text [COVERAGE-TEXT]] [--coverage-crap4j [COVERAGE-CRAP4J]] [--coverage-phpunit [COVERAGE-PHPUNIT]] [--no-exit] [-g|--group GROUP] [-s|--skip SKIP] [-x|--skip-group SKIP-GROUP] [--env ENV] [-f|--fail-fast] [--no-rebuild] [--] [<suite>] [<test>]

Process finished with exit code 1
Deltik commented 6 years ago

@CaMer0n

The "Custom working directory" should be left blank because the test suites are already configured to expect e107 in the subfolder ./e107.

You're encountering a problem with the mysql command because it doesn't exist in your environment, so the e107 database dump cannot be imported. The mysql command is used as a "populator", which you can find in ./codeception.yml

I'm not sure how to make that platform-independent yet, but perhaps you can try providing the full path to your Windows MySQL binary instead of just mysql?


Additional Information

Here's additional information for others who might be using PhpStorm.

PhpStorm doesn't support Git submodules, so using Git 1.8.2 or newer, run the following command:

git submodule update --init --recursive --remote

That will update the two submodules that this project currently uses:

PhpStorm may or may not detect the new Git roots (the submodules). Register those roots.

![screenshot_20180214_104254](https://user-images.githubusercontent.com/1364268/36216322-110b368e-1174-11e8-9f4f-ef4a23a62f47.png)

You can do this manually in File » Settings… » Version Control (Ctrl+Alt+s, then Version Control) and then selecting each unregistered root and pressing the green plus button:

screenshot_20180214_100832

You should now be able to work with e107's code in the e107 folder:

screenshot_20180214_104933

You've already done the composer update step, so Codeception should be installed to ./vendor/bin/codecept. Ensure that PhpStorm sees it in Settings » Languages & Frameworks » PHP » Test Frameworks:

screenshot_20180214_105953

See also: Testing with Codeception

The Run/Debug Configurations should be configured like @CaMer0n's, except for the "Custom working directory", which should be left blank:

Deltik commented 6 years ago

@CaMer0n: MySQL importing should be platform-independent now after f080402675b6aebe4a73bba3ed1a82461d737239.

Deltik commented 6 years ago

@CaMer0n: Correction: f080402 doesn't fix the problem. a18ca98f9a41dc1d36a8e651c0365d699a7b98d5 does, but I think you're having a different (and unrelated) issue now.

CaMer0n commented 6 years ago

Thank you. I submitted an issue with jetbrains. https://intellij-support.jetbrains.com/hc/en-us/requests/1255499?page=1