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
Related
Actually, I'm trying to add new language to Streama Media Server. I downloaded source code, added new language file (as guided here). After that, I want to build a jar with that project, I build it with IntelliJ Idea 2021.1 (here is how I did). So, When I run that jar file (in Ubunt 20.04), it fails and gives this error: Screenshot
When you have made adjustments to the source code, it is likely that you will want to create a new .jar file and deploy it on your server. For this, you can use a simple command:
# for unix based systems
**./gradlew assemble**
# for windows
**./gradlew.bat assemble**
This will create 2 new .jar files under build/libs,
streama-{version}.jar
streama-{version}.jar.original
all you will need is the streama-{version}.jar.
This file is an executable, so you can just copy it into your deployment directory / your server and start it as usual.
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
I am porting AXIS 2 SOAP webservice to an existing grails 2.4.4 project.
It works flawlessly when run from the IDE but not fram a WAR.
I have tracked this down to addresing.mar NOT being copied to the WEB-INF lib directory. If I copy this file myself then ever thing works fine.
We are using Jenkins for CI and using the Grails plugin to do the compilation of and packaging of the WAR file.
This does not include the addresing.mar file. Also when running the Grails war command it is not included.
I have tried many way to get this to be included. The AXIS plug in just wrecks the compile to teh extent that it is unusable.
I have just spent 2 days googling and tried ever thing I can find in just about every combination.
We are now getting to the point we we are considering post processing the war file and adding the addresing.mar file directly.
Though that will work it would not help my understanding of what I am doing wrong!
Any help most appreciated.
Try saving your file inside the /src file. Grails autowires external libraries when saved inside this folder.
Note: This is only applicable to Grails versions running less than 3.x.x
I don't know too much about AXIS 2 SOAP and the mentioned addressing.mar file but if it's available in the project while building the war file you could use the grails.war.resources parameter in BuildConfig.groovy and simply copy it into the lib directory in the following way:
grails.war.resources = { stagingDir, args ->
copy(file: "path/to/addressing.mar", todir: "${stagingDir}/WEB-INF/lib/")
}
more info about grails.war.resources in the manual
I would like to run some unit Tests individually with PHPUnit, but I have certain classes separated from the Tests, since I am using the symfony framework, and I group the Tests and the Classes in different folders.
I would like to run the Tests individually like this:
php phpunit.phar MyTest.php
The problem is that the test file uses the classes from the controllers, and phpunit doesnt seem to be able to import the needed classes for the test.
This is not a problem to run all the tests together, thanks to phpunit.xml but when I want to run them individualy, its a problem.
How could I fix this?
You have to point phpunit where you have your phpunit.xml config file (because it must know the autoloader for example). If you have default symfony 2 structure it will be in app directory, so just run your test like that (I assume that you are in project root path):
phpunit -c app/ --filter="concreteTestPattern" src/Acme/DemoBundle/Tests/MyTest.php
edit:
Above will run all tests which names match to the pattern: /.*concreteTestPattern.*/
You would use the --filter argument in your PHPUnit command string. This will only run tests that match the pattern given. If you pass only the complete name of the test that you want run, phpunit should only run that test.
If you have a data provider associated with the test and only want to run one test case, you can also filter that by using --filter <testName>::<testcase name>
PHPUnit can be set to execute using a configuration file.
In our Symfony2 project this file is located at app/phpunit.xml.dist.
As this file is suffixed with .dist, you need to copy its contents into a file called app/phpunit.xml.
If you are using a VCS such as Git, you should add the new app/phpunit.xml file to the VCS ignore list.
You will also notice the configuration is specifying the bootstrap file located at app/bootstrap.php.cache. This file is used by PHPUnit to get the testing environment setup.
We can execute this test by running the following command from the root directory of the project. The -c option specifies that PHPUnit should load its configuration from the app directory.
$ phpunit -c app
Im trying to learn to make a web installer using Windows Installer XML (WIX 3.5). I found this blog about using msbuild in .wixproj files to avoid the scenario where the installer ends up dropping the web project assemblies right in the root of the app instead of keeping them in the bin folder like they're supposed to be.
Here is the link to that:
<http://www.paraesthesia.com/archive/2010/07/30/how-to-consume-msdeploy-staged-web-site-output-in-a.aspx>
But after adding the MSBuild scripts in the .wixproj file, I don't know what to do anymore. According to the instruction after adding the MSBuild script:
"When that target runs, you'll see a .wxs file pop out in the .wixproj project folder. Add the generated .wxs to your .wixproj project so it knows to include it in the build."
I really don7t know what this means. How can I run the target? I tried to build it but there was no .wxs file generated in the .wixproj folder.
Am I missing something? Please help...
Assuming you have added the section from the tutorial:
<Target Name="BeforeBuild">
...
</Target>
The target will be run automatically when you build the project. The "BeforeBuild" target is one of the standard entry-points to add your own modifications to the build. The target will then generate a file (named [WebProjectName].wxs that is placed in the same directory as your wixproj file. Click on the show all files button in visual studio and right-click on the file and "Include in project" That will then include the wxs is your installer and when you next build it will have the correct folder/file structure.