PHPStorm phpunit loads configuration other project - phpunit

When running a test using PHPStorm it loads a configuration from an other project.
/usr/bin/php /private/var/folders/jv/rch25xnj6y3cl_yf4s6qq64m0000gn/T/ide-phpunit.php --bootstrap /Users/reneterstegen/Sites/www.domain1.com/app/bootstrap.php.cache --configuration /Users/reneterstegen/Sites/www.one-of-my-other-projects.com/app/phpunit.xml.dist --filter "/::itLoadsTheForm( .*)?$/" Stegeman\Bundle\SearchBundle\Tests\SearchControllerTest /Users/reneterstegen/Sites/www.domain1.com/src/Stegeman/Bundle/SearchBundle/Tests/SearchControllerTest.php
This causes a fatal:
Class 'JMS\SerializerBundle\JMSSerializerBundle' not found in /Users/reneterstegen/Sites/www.one-of-my-other-projects.com/app/AppKernel.php on line 21
This makes sense since the project I am testing is nog using this bundle.
I've already set the default configuration file and default bootstrap file settings in the PHPUnit section in preferences.
Question: Can somebody tell me how to change the configuration used by phpunit in PHPStorm?

Can somebody tell me how to change the configuration used by phpunit in PHPStorm?
You can always specify custom ("alternative") config file per Run/Debug Configuration -- it will be used instead of Default one that you have set in Preferences.
https://confluence.jetbrains.com/display/PhpStorm/PHPUnit+support+in+PhpStorm#PHPUnitsupportinPhpStorm-3.CreatingaRunConfiguration
Here you have to tick the "Use alternative configuration file" and specify full path to it (either manually or via "..." button). NOTE: if you click on a button next to "..." one it will allow you to edit paths to Default config files (the ones from Preferences).
Please note that if you have defined your bootstrap file in that Default section as well .. it will also be used and AFAIK you cannot override it. It will be better if you provide bootstrap file in actual config file.

Related

How to create tailwind.config.js in custom directory instead of root folder with init command

I am using below npx command to generate tailwind.config.js file, it is creating this file in root directory by default. I want to create it in custom /config folder. Could anyone please guide me.
Also wanted to know what all changes are needed for tailwind to work with config residing in custom folder.
npx tailwindcss init
Thanks in advance.
init command may accept one of these flags - -f to create full tailwind config and -p to create it with additional postcss.config.js. You may change directory and create config file there - not sure is it good for you or not
cd config && npx tailwindcss init
Every path within your config file is relative so pay attention at content section. Also your compiler as well must have correct path to config file, for example require('tailwindcss')('./config/tailwind.config.js') - but it depends in a way you compile styles

PhpStorm doesn't get the folder's configuration when running a single test method

I have a Laravel project with three test directories - Browser, Feature, and Unit.
In Run/Debug configurations I've configured the Feature and the Unit directories to use phpunit.xml while the Browser directory uses phpunit.e2e.xml. I've also created a default configuration for all tests which uses the phpunit.xml.
If I open a class that is in the Feature/Unit directories and run a single test method or the whole class, it picks the default configuration, but when I run a single test method in the Browser directory, it uses phpunit.xml instead of phpunit.e2e.xml.
If I select a directory and run tests, it picks the proper configuration, but when I open a class in the Browser directory, it doesn't
Why doesn't PhpStorm use the configuration of the Browser directory recursively? How can I handle this problem?
As far as I know PhpStorm has never had this functionality and I wouldn't count on them adding it either. It seems way too specific.
What you can do though, is specify the configuration file you want to use through the commandline.
See: https://phpunit.de/manual/6.5/en/textui.html#textui.clioptions
So your command would look something like this:
phpunit tests\Unit\SomeTest.php --configuration phpunit.xml
or
phpunit tests\Browser\SomeTest.php --configuration phpunit.e2e.xml

Set sbt options in build.sbt

I'm working on an SBT project that has to be built with the options like:
-Xmx2G -Xss256M -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled
This means that every new developer has to read the readme and assign the options to SBT_OPTS in bash profile or put them in the sbtopts file. Similarly, this has to be configured on Jenkins and this applies to all the projects (so if someone wants to use -XX:+UseG1GC with other projects it becomes an issue). Is it possible to specify the required options in the build file itself? This seems logical to me, as the options are project-specific and without them, you cannot build the project.
Create a .sbtopts file at the root of the build with contents:
-J-Xmx2G
-J-Xss256M
-J-XX:+UseConcMarkSweepGC
-J-XX:+CMSClassUnloadingEnabled

Reuse test resources (logback-test.xml) from dependent project with SBT

I've got 3 project defined in my Build.scala file:
common
services.dependsOn(common)
web.dependsOn(common)
Project Common contains /test/resources with logback-test.xml configuration which I would like to use for services and web tests.
This setup works fine in intelliJ with sbt-idea but when I try to run 'sbt test' from command line the logback-test.xml isn't copied over to /services/target/testClasses or /web/target/testClasses which means that the tests will use default slf4j configuration with useless tons of DEBUG info.
What should I do to force sbt to copy test resources from dependent project to others.
Thanks in advance
Dependencies don't include test configuration by default. You can change this like so:
common
services.dependsOn(common % "compile->compile;test->test")
web.dependsOn(common % "compile->compile;test->test")
More info here

PHPUnit, Netbeans and Symfony2 and wrong tests location

I try to understand PHPUnit tests in Netbeans. I set correct phpunit.bat path and the phpunit-skelgen.bat file as well.
When I try to create test for some file, using the netbeans option such us "create test file" I get correct directory structure, but the files are placed incorrectly.
Next, following the tutorials from web I set the test folder (to jobeet/tests), the phpunit bootstrap to jobeet\app\bootstrap.php.cache and the xml configuration file to jobeet\app\phpunit.xml.dist
Please see the screenshots below

Resources