1

I've installed the latest version of CakePHP, then installed PHPUnit using PEAR and tried to get access using such link as

http://localhost/[project_name]/test.php

But as a result I've got a message that PHPUnit is not installed. I can't understand what the problem is. Are there any other ways to solve this problem ?

And is it possible not to install PHPUnit, but just copy all its files to, for example, Vendor directory of CakePHP and to use it locally just for one separate project ?

1

2 Answers 2

1

I disagree with Mark. :)

The most easy way to install phpunit systemwide is using composer as described on their installation page:

For a system-wide installation via Composer, you can run:

composer global require 'phpunit/phpunit=3.7.*'
Sign up to request clarification or add additional context in comments.

1 Comment

i did this but the cakephp shell couldn't recognize the phpunit installation.
0

The easiest way in Win is https://github.com/dereuromark/cakephp-phpunit That is standalone and will all work out of the box with

cake Phpunit.Phpunit install

It has no dependencies outside of CakePHP itself. No composer, no pear no other 3rdparty issues.

If you do have one of those dependencies available, use that one, though.


Note: As of now the pear channel has been shut down and as such there is only the composer solution to it now. (See other answer)

6 Comments

From which exactly directory have I to run this command, because "cake" is not standard command? And which path have I to add to system_path this command to work from everywhere?
Yes, it works without modifications to system paths. But you need to have your cake console working (which is kind of a default for using CakePHP anyway). See the docs on how to get the basic console working. Usually, all you need to do is add PHP to your system path and use .\Console\cake [command].
Ok, I did such steps: 1. According to official instruction I've created folder called Phpunit in app/Plugin and copied all plugin files there 2. Then I've add to Windows System Variable "Path" link to where cake.bat is ([path_to_project]\lib\Cake\Console) 3. Then tried to run this command "cake Phpunit.Phpunit install", but got an error "Plugin Phpunit could not be found" I even don't know what the problem is? Can you help me with this one?
You forgot to include the plugin via CakePlugin::loadAll() etc. You seriously need to upgrade your reading skills as this is all part of the documentation there in the readme as well as part of the official cakephp docu on how to get plugins working.
cakephp-phpunit doesn't seem to work any more now that pear.phpunit.de has been retired - github.com/sebastianbergmann/phpunit/wiki/…
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.