How to configure PHPUnit with ZF version 1.12.11 - zend-framework

I am using zend framework 1.12.11 and now I want to use PHPunit with it.Pear has stopped it's stopped support for phpunit.Now it's working with composer.
I have install composer and phpunit via composer.But Where I have to put composer json setting file and my project and what should include in my project which automatically take phpunit of composer

Per the PHPUnit documentation for Composer installation, add PHPUnit to the dependencies in your project's composer.json file, something like:
{
"require-dev": {
"phpunit/phpunit": "4.6.*"
}
}
Then run:
composer update -vvv phpunit/phpunit
to actually bring PHPUnit and its dependencies down into your project.
I usually add the -vvv (maximally verbose) flag to see what's going on under the hood. Feel free to omit if you prefer.
Once they are all installed, you can run phpunit the usual way by accessing the executable bin script that PHPUnit and Composer expose for you. From the project root, you should be able to run:
./vendor/bin/phpunit --version
to confirm the install is ok.
Once you have a phpunit.xml config file set up that your test suites and directories, you should be able to run your tests using:
./vendor/bin/phpunit -c /path/to/phpunit.xml

Related

Unable to run/debug robot tests in vscode - robocorp extensions installed

I have installed Robocorp Code as well as Robot Framework Language Server and have configured them. However, I am still having errors when trying to run the tests via the code lens options.
Repo - A webapi repo with a specific folder containing all tests. Lets call it regression.
RF - 4.1.3
Python - 3.8
This is what happens when I click on Run on the code lens for any of the tests -
`PS C:\git\xxxx\regression> C:; cd 'C:\git\xxxx\regression'; &
'C:\Users\xxxx\AppData\Local\Temp\rf-ls-run\run_env_00_smh5defr.bat'
'-u'
'c:\Users\xxxx.vscode\extensions\robocorp.robotframework-lsp-0.47.2\src\robotframework_debug_adapter\run_robot__main__.py'
'--port' '54331' '--no-debug' '--argumentfile'
'C:\git\xxxx\regression\args-local.txt' '--pythonpath'
'c:\git\xxxx\regression\common\lib' '--variable'
'EXECDIR:C:/git/xxxx/regression'
'--prerunmodifier=robotframework_debug_adapter.prerun_modifiers.FilteringTestsSuiteVisitor'
'c:\git\xxxx\regression\api\api_Test.robot'
[ ERROR ] Parsing'--pythonpath' failed: File or directory to execute does not exist.
However, the test starts if I remove the argumentfile parameter but it, of course, fails because its missing arguments from the file.
Do note that the folder specified in pythopath exists and has some python libraries needed for the tests.

Purescript 0.12 Getting Started

i`m trying to run the very basic flow:
1) install tools:
npm install -g pulp bower
Pulp version 12.2.0
purs version 0.12.0 using C:\Users\panda.psvm\current\bin\purs.EXE
C:\Users\panda>bower --version
1.8.4
2) following steps from this answer i installed purs https://stackoverflow.com/a/50554135/1358421
C:\Users\panda>purs --version
0.12.0
Ok, lets create a project.
c:\home\projects\sandbox\purr>mkdir hello-purr
c:\home\projects\sandbox\purr>cd hello-purr
c:\home\projects\sandbox\purr\hello-purr>
pulp init
c:\home\projects\sandbox\purr\hello-purr>pulp init
* Generating project skeleton in c:\home\projects\sandbox\purr\hello-purr
bower purescript-console#* cached https://github.com/purescript/purescript-console.git#4.1.0
bower purescript-console#* validate 4.1.0 against https://github.com/purescript/purescript-console.git#*
bower purescript-prelude#* cached https://github.com/purescript/purescript-prelude.git#4.0.0
bower purescript-prelude#* validate 4.0.0 against https://github.com/purescript/purescript-prelude.git#*
bower purescript-prelude#^4.0.0 cached https://github.com/purescript/purescript-prelude.git#4.0.0
bower purescript-prelude#^4.0.0 validate 4.0.0 against https://github.com/purescript/purescript-prelude.git#^4.0.0
bower purescript-effect#^2.0.0 cached https://github.com/purescript/purescript-effect.git#2.0.0
bower purescript-effect#^2.0.0 validate 2.0.0 against https://github.com/purescript/purescript-effect.git#^2.0.0
bower purescript-console#^4.1.0 install purescript-console#4.1.0
bower purescript-prelude#^4.0.0 install purescript-prelude#4.0.0
bower purescript-effect#^2.0.0 install purescript-effect#2.0.0
purescript-console#4.1.0 bower_components\purescript-console
├── purescript-effect#2.0.0
└── purescript-prelude#4.0.0
purescript-prelude#4.0.0 bower_components\purescript-prelude
purescript-effect#2.0.0 bower_components\purescript-effect
└── purescript-prelude#4.0.0
bower purescript-psci-support#* cached https://github.com/purescript/purescript-psci-support.git#4.0.0
bower purescript-psci-support#* validate 4.0.0 against https://github.com/purescript/purescript-psci-support.git#*
bower purescript-psci-support#^4.0.0 install purescript-psci-support#4.0.0
purescript-psci-support#4.0.0 bower_components\purescript-psci-support
├── purescript-console#4.1.0
├── purescript-effect#2.0.0
└── purescript-prelude#4.0.0
Skeleton of project successfully generated.
Trying to run it:
pulp run
* Building project in c:\home\projects\sandbox\purr\hello-purr
Error 1 of 2:
in module Main
at src\Main.purs line 4, column 1 - line 4, column 31
Module Control.Monad.Eff was not found.
Make sure the source file exists, and that it has been provided as an input to the compiler.
See https://github.com/purescript/documentation/blob/master/errors/ModuleNotFound.md for more information,
or to contribute content related to this error.
Error 2 of 2:
in module Main
at src\Main.purs line 5, column 1 - line 5, column 48
Module Control.Monad.Eff.Console was not found.
Make sure the source file exists, and that it has been provided as an input to the compiler.
See https://github.com/purescript/documentation/blob/master/errors/ModuleNotFound.md for more information,
or to contribute content related to this error.
* ERROR: Subcommand terminated with exit code 1
No luck :(
pulp test
pulp build
The same errors - It can`t find modules.
Did i miss something? Please, advice.
Thanks
Purescript 0.12 pulls in newer versions of the Effect and Console libraries, unfortunately pulp init has not yet been updated to correct the generated example to match (see https://github.com/purescript-contrib/pulp/issues/337)
just update the code in Main.purs to:
module Main where
import Prelude (Unit)
import Effect
import Effect.Console (log)
main :: Effect Unit
main = do
log "Hello sailor!"`
to get started.
Found solution.
don't need bower at all
instead, there is a psc-package (another package manager)
it didn't installed correctly on my Windows 10 with npm install -g psc-package
there was no psc-package.exe file in directory ${username}\AppData\Roaming\npm\node_modules\psc-package\vendor
So, you need to fix install.js file and replace
ignore: ['psc-package']
with
ignore: [bin.use()]
then run fixed installation with
${username}\AppData\Roaming\npm\node_modules\psc-package\lib> node install
after that, In the vendor folder you may find psc-package.exe
Then, i followed this tutorial:
https://github.com/justinwoo/purescript-0.12.0-hello-world
and
Build successful.
look, show on Record:
{ apple: "banana" }

Force py.test to use installed version of module

I have a mixed Python/C++ library with test files mixed in amongst source files in the same directories. The layout looks like
/home/irving/geode
geode
__init__.py
vector
__init__.py
test_vector.py
...
...
Unfortunately, the library is unusable in-place since it lacks .so extension modules. Question: Can I make py.test always use an installed version, even when run from /home/irving/geode or a subdirectory?
The test files have from __future__ import absolute_import, and run fine if executed directly as scripts. For example, if I do
cd geode/vector
./test_vector.py
which does import geode, it finds the installed version. However, if I run py.test in geode/vector, it finds the local copy of geode, and then dies.
I think you have two options:
run py.test --pyargs geode.vector.test_vector to make pytest interpretet the argument as an import path, deriving the file system path from it. This should run the test against the installed version.
move the tests out into a tests directory without an __init__.py file. This way you need to pip install -e . to work in-place or can do python setup.py install and the py.test tests to run tests against the installed version.

Zend Framework (PHPUnit) Tests won'r run (phpunit: command not found / Class 'PHPUnit_Framework_TestCase' not found)

i installed PHPUnit by the book:
sudo pear channel-discover pear.phpunit.de
sudo pear install phpunit/PHPUnit
The include path is added in the /etc/php5/cli/php.ini
include_path = ".:/usr/share/php"
$ ls /usr/share/php/PHPUnit/
Extensions Framework
But now, if I want to run the Tests for Zend Framework
user#server:/var/www/page/tests$ ./runtests.sh
+ phpunit --verbose AllTests
./runtests.sh: line 72: phpunit: command not found
user#server:/var/www/page/tests$ php AllTests.php
PHP Fatal error: Class 'PHPUnit_Framework_TestCase' not found in /var/www/page/tests/Zend/Acl/AclTest.php on line 37
Of course i also get a phpunit: command not foundwhen i try to follow the instructions in the PHPUnit Manual http://www.phpunit.de/manual/3.6/en/writing-tests-for-phpunit.html outside of Zend Framework Context.
I'm getting the Feeling I'm missing something essential here ...
Solved
Looks like there was a Problem with the PEAR Channels, after adding the other 2 Again, it worked:
pear channel-discover components.ez.no
pear channel-discover pear.symfony-project.com
Since the problem was solved in the comments I just make a real answer to sum up.
The reason for the problem was missing phpunit command. Reinstallation of phpunit and setting variable PATH to the folder containing phpunit command (export PATH=$PATH:/path/to/folder/with/phpunit) solved the issue.

Why would Eclipse not be able to include a file when running a PHPUnit test?

I have the following class and unit test in a PHP project in Eclipse:
I know my unit test works as I can run it at the command line:
Now I want to run this test from Eclipse. I set up PHP Unit in Eclipse like this:
However, when I run the PHPUnit tests:
It tells me that it can't include the class file:
/usr/bin/php -c /var/folders/UA/UAv38snBHd0QMgEPMCmM9U+++TM/-Tmp-/zend_debug/session4910937990995915704.tmp -d asp_tags=off /Applications/eclipse/plugins/org.phpsrc.eclipse.pti.tools.phpunit_0.5.0.R20101103000000/php/tools/phpunit.php --log-junit /var/folders/UA/UAv38snBHd0QMgEPMCmM9U+++TM/-Tmp-/pti_phpunit/phpunit.xml /Volumes/data/domains/et/extjslayout/phpunittest/tests
PHP Warning: include_once(../Product.php): failed to open stream: No such file or directory in /Volumes/data/domains/et/extjslayout/phpunittest/tests/ProductTest.php on line 3
PHP Warning: include_once(): Failed opening '../Product.php' for inclusion (include_path='/usr/local/PEAR') in /Volumes/data/domains/et/extjslayout/phpunittest/tests/ProductTest.php on line 3
PHP Fatal error: Class 'Product' not found in /Volumes/data/domains/et/extjslayout/phpunittest/tests/ProductTest.php on line 9
Why would PHPUnit be able to find the class when run from the command line but not when run from Eclipse?
When you start something from the command line, the "current directory" has a well-defined meaning: It's the directory where you started the command.
In Eclipse, what is the "current directory"? It's probably the directory from which you started Eclipse or maybe the folder in which Eclipse is installed.
I haven't used PHP in Eclipse before but for other languages, I can set the current directory in the launch config somewhere. If that doesn't work, define a variable which points to your project and then use absolute paths (using that variable as a starting point).
Have same problem. Found only solution by creating tests with internal PHPUnit wizard like at this screenshot:
Source: HowTo create a Test Case Class from a PHP Class
But following investigate show that your test case file should contain reference to tested code for example like this: require_once 'C:\Apache2\htdocs\jobeet\src\Ibw\JobeetBundle\Utils\Jobeet.php';
Other experiments with plugin config not bringing luck. So in my opinion PHPUnit from PHP Tools not well developed plugin. Consider using MakeGood plugin as better alternative.