PhpUnit downloadet manually ... Framework.php not found
After trying to install PhpUnit over pear over many days.
i decided to download it manually. (409 KB ZIP from https://github.com/sebastianbergmann/phpunit/ )
i copied PHPUnit it into
... ZendServer\ZendServer\bin\
next i searched for a hello world PhpUnit and found
require_once 'PHPUnit/Framework.php';
class ArrayTest extends PHPUnit_Framework_TestCase
...
But Framework.php is not in the PhpUnit Folder.
Seem to be crazy vor me. ?:|
I tried to understand configuration in PhpUnit. I understand nothing. It asks me for xml-Config-Files. I dont have any.
What could i do to rin PhpUnit?
May i copy it into htdocs- Folder and use it as normal as every other php-class ?
I never thought that it could be so difficult to install such (simple?) think. strange, crazy.
I hope you could help or have ideas. Thank
BTW this tutorial dont work for me http://inchoo.net/tools-frameworks/installing-setting-up-phpunit-manually-without-pear/
becouse i dont have a PHPUnit/phpunit.bat File.
Seems every PHPUnit - Installation is unique ;) ?
FileList von \ZendServer\ZendServer\bin\PHPUnit\Framework\
\ZendServer\ZendServer\bin\PHPUnit\Framework\Assert.php .. ..
\ZendServer\ZendServer\bin\PHPUnit\Framework\AssertionFailedError.php .. ..
\ZendServer\ZendServer\bin\PHPUnit\Framework\Comparator.php .. ..
\ZendServer\ZendServer\bin\PHPUnit\Framework\ComparatorFactory.php .. ..
\ZendServer\ZendServer\bin\PHPUnit\Framework\ComparisonFailure.php .. ..
\ZendServer\ZendServer\bin\PHPUnit\Framework\Constraint.php .. ..
\ZendServer\ZendServer\bin\PHPUnit\Framework\Error.php .. ..
\ZendServer\ZendServer\bin\PHPUnit\Framework\Exception.php .. ..
\ZendServer\ZendServer\bin\PHPUnit\Framework\ExpectationFailedException.php .. ..
\ZendServer\ZendServer\bin\PHPUnit\Framework\IncompleteTest.php .. ..
\ZendServer\ZendServer\bin\PHPUnit\Framework\IncompleteTestError.php .. ..
\ZendServer\ZendServer\bin\PHPUnit\Framework\OutputError.php .. ..
\ZendServer\ZendServer\bin\PHPUnit\Framework\SelfDescribing.php .. ..
\ZendServer\ZendServer\bin\PHPUnit\Framework\SkippedTest.php .. ..
\ZendServer\ZendServer\bin\PHPUnit\Framework\SkippedTestError.php .. ..
\ZendServer\ZendServer\bin\PHPUnit\Framework\SkippedTestSuiteError.php .. ..
\ZendServer\ZendServer\bin\PHPUnit\Framework\SyntheticError.php .. ..
\ZendServer\ZendServer\bin\PHPUnit\Framework\Test.php .. ..
\ZendServer\ZendServer\bin\PHPUnit\Framework\TestCase.php .. ..
\ZendServer\ZendServer\bin\PHPUnit\Framework\TestFailure.php .. ..
\ZendServer\ZendServer\bin\PHPUnit\Framework\TestListener.php .. ..
\ZendServer\ZendServer\bin\PHPUnit\Framework\TestResult.php .. ..
\ZendServer\ZendServer\bin\PHPUnit\Framework\TestSuite.php .. ..
\ZendServer\ZendServer\bin\PHPUnit\Framework\Warning.php .. ..
\ZendServer\ZendServer\bin\PHPUnit\Framework\Assert\Functions.php .. ..
\ZendServer\ZendServer\bin\PHPUnit\Framework\Comparator\Array.php .. ..
\ZendServer\ZendServer\bin\PHPUnit\Framework\Comparator\DOMDocument.php .. ..
\ZendServer\ZendServer\bin\PHPUnit\Framework\Comparator\Double.php .. ..
\ZendServer\ZendServer\bin\PHPUnit\Framework\Comparator\Exception.php .. ..
\ZendServer\ZendServer\bin\PHPUnit\Framework\Comparator\MockObject.php .. ..
\ZendServer\ZendServer\bin\PHPUnit\Framework\Comparator\Numeric.php .. ..
\ZendServer\ZendServer\bin\PHPUnit\Framework\Comparator\Object.php .. ..
\ZendServer\ZendServer\bin\PHPUnit\Framework\Comparator\Resource.php .. ..
\ZendServer\ZendServer\bin\PHPUnit\Framework\Comparator\Scalar.php .. ..
\ZendServer\ZendServer\bin\PHPUnit\Framework\Comparator\SplObjectStorage.php .. ..
\ZendServer\ZendServer\bin\PHPUnit\Framework\Comparator\Type.php .. ..
\ZendServer\ZendServer\bin\PHPUnit\Framework\Constraint\And.php .. ..
Please sign in to leave a comment.
Hi Sebastian,
AFAIK that file is now obsolete (as of v3.6 or maybe even v3.5). But you will not need this file any way (this line is no more found in modern test classes: require_once 'PHPUnit/Framework.php';).
You can find simple test examples in official documentation: http://www.phpunit.de/manual/current/en/writing-tests-for-phpunit.html
In any case -- I still recommend installing PHPUnit via PEAR (try reinstalling PEAR first, in case you have problems with actual PEAR itself) -- it's much easier to maintain updated version + possible dependencies this way.
If you are unable to execute tests from command line -- make sure that path to PHPUnit root folder is listed in include_path variable of php.ini. Also -- make sure that you are editing correct php.ini (I do not know what OS you have there etc, but Zend and Linux/Mac may have more than one php on a system which could use different php.ini files).
When you launching PHPUnit tests from IDE, PhpStorm will launch it via intermediate helper script (for some basic diagnosis + integration purposes), but all the testing will still be done by main phpunit code. If it fails to launch from PhpStorm for some reason -- you will need to provide more details (so far I think I saw none). In any case -- using local PHPUnit tests from within PhpStorm requires you to have PHP installed on your computer (which I assume you already have).
To have code completion for PHPUnit methods (as well as PhpStorm to be able to recognize test files as PHPUnit tests) just add PHPUnit folder as External Library (Settings | PHP).
XML-config files as well as bootstrap file are optional in PhpStorm (it all depends how you write your test cases, what additional code it must run in order to find your classes or load any additional data used by tests -- the more complicated your tests then usage of XML-config file/bootstrap could be required, but for simple introductionary tests they are not needed).
i did. but if i type phpunit in comand line. command is not know. hmm. i restarted Apache and got also not positv result.
is searched with google for " Php execute tests from command line".
my os is vista64.
i addet to include_path of php.ini :
include_path=" .... :\ZendServer\ZendServer\lib\PHPUnit"
How could i test if php.ini got any effect?
i typed bullshit into php.ini restared apache but got no error message.
hmmm
BTW. i dont like quiting here in comunity. i like > syntax.
1) If you install PHPUnit manually, then you need to make sure that path to phpunit.bat is present in operating system's PATH variable (My Computer | Properties | Advanced | Environment Variables -- that's on Windows 7; Restart may be required) unless you are trying to execute phpunit command from the folder where that .bat file is located.
2) Apache has nothing to do (and not required at all) with running PHPUnit tests -- it will be executed using CLI mode (phpunit.bat will call php.exe with path to the actual phpunit php file).
thanks
is only in my download folder.
so i copied it to the phpunit.
...\ZendServer\ZendServer\lib\PHPUnit
in the path i found this entries:
...\ZendServer\ZendServer\bin;
...\ZendServer\ZendServer\share\ZendFramework\bin;
and i addet the ... \lib\PHPUnit also (may not necessary)
restarted OS.
if i call now phpUnit in command line. it sounds better:
...>phpunit
command ""@php_bin@"" wrong written or not found.
hmmm. whats next. hmm. probably it needs parameters. may a test-class or so.
If you installed PHPUnit into \ZendServer\ZendServer\bin\PHPUnit\ folder (as you said in very first message), then phpunit.bat should be located in \ZendServer\ZendServer\bin\PHPUnit\phpunit.bat (the bat file is in the archive) and that folder should be in included in the PATH variable of the OS environment (Windows does not search in subfolders, only in folders explicitly provided).
In any case -- since you are doing manual installation, you will need to edit that bat file -- you need to provide FULL PATH to php.exe (see @php_bin@). You will also need to edit another "variable" -- @bin_dir@ -- you should figure this out (PEAR will do that for you automatically).
I still suggest you to try solving your PEAR installation issue -- will make your life much easier when installing any other packages/dependencies.
In any case -- I think http://stackoverflow.com/ is much better place for such general questions (installing PHPUnit manually .. or PEAR itself) since it has nothing to do with actual PhpStorm or any other IDEA based IDE.
thanks but this was what i tried first. and found many problems with it (and was with it not alone, what some blogs told me).
may i have to try this in days again. i will see (it downloadet some .... some tutorials did not work for me.) there was also youtube-tutorials. i look sooo very easy but worked not here at my OS. i will try, i will see.
so i try to config the bat-file next. thanks.
may helpful for others:
edit 12-08-06_15-36:
heres a example phpunit.bat http://nickbartlett.com/wordpress/how-to-install-phpunit-on-windows/
I suggest playing with it in virtual environment (which is easy to reset to previous snapshot in case of failure -- Oracle VirtualBox is free). Once you have it running there you can transfer you experience into your real environment (uninstall previous PEAR installation completely before making new attempt, including registry entries -- just search for instructions). You may want to doawnload latest PEAR from their website instead of using the one bundled with PHP (when I was installing it for a first time over a year ago, original failed to install, while latest version worked just fine).
could i ask you.
do i need alway restart windows after every change of phpunit.bat (i dont see effect of my changes).
BTW Oracle VirtualBox i used many years at this system (great tool). but yet it starts not. i reinstalled it but no effect.
i updated PEAR with the update commands. its the latest.
BTW ;) see what you could read there ;) so he also got difficulties ... i actually started reading his blog:
"After about ten hours of fighting with PEAR and PHPUnit, I think I have it installed correctly as my test case was able to run. There are a couple “official” documentation sources on how to install PHPUnit, but they only bother to cover installing it on linux."
http://nickbartlett.com/wordpress/how-to-install-phpunit-on-windows/
No -- it's a batch file which reads again on every execution and not environment variable (which sometimes can affect only new user session (e.g. restart of explorer.exe should be enough in most cases instead of restarting whole OS or log off and log on again))
my foult was
%PHPBIN% seems not empty
:8}
this works:
rem if "%PHPBIN%" == ""
set PHPBIN="XYZ:\ZendServer\ZendServer\bin\php.exe"
"%PHPBIN%" "XYZ:\ZendServer\ZendServer\lib\phpunit" %*
so error changed:
XYZ:\ZendServer\Apache2\htdocs\doSqlWeb>phpunit ArrayTest.php
Could not open input file: XYZ:\ZendServer\ZendServer\lib\phpunit
XYZ:\ZendServer\Apache2\htdocs\doSqlWeb>
i wondering. becouse its folder not a file. sure. hmmm.
edit at 12-08-06_17-06 this gife no errors :), but also no output:
XYZ:\ZendServer\Apache2\htdocs\doSqlWeb>XYZ:\ZendServer\ZendServer\bin\php.exe XYZ:\Ze
ndServer\Apache2\htdocs\doSqlWeb\ArrayTest.php
XYZ:\ZendServer\Apache2\htdocs\doSqlWeb>
what i could learn from it?
?:| hmmm.
<?php
class StackTest extends PHPUnit_Framework_TestCase
{
public function testPushAndPop()
{
$stack = array();
$this->assertEquals(0, count($stack));
array_push($stack, 'foo');
$this->assertEquals('foo', $stack[count($stack)-1]);
$this->assertEquals(1, count($stack));
$this->assertEquals('foo', array_pop($stack));
$this->assertEquals(0, count($stack));
}
}
?>
The "phpunit" file is not present in manual installation -- I guess it needs to be replaced by "phpunit.php" (the contents is the same as in my PEAR installation)
There is no phpunit.php file in my PHPUnit Folder (or SubFolder).
i tired installing wit pear again ;) see screensho ;) http://www.phpunit.de/manual/2.3/de/installation.html
ohh. what a game :)
Attachment(s):
Administrator System32cmd.png
Basically -- phpunit.bat is a warpper for phpunit, since Windows cannot execute such files directly (as it does not support "executable" attribute and cannot automatically detect what interpreter to use (as it's done via shebang in *nix )).
I strongly suggest using more up-to-date manual / installation instructions (although I do not think it will make huge difference here).
You are referring to v2.3 .. while latest stable version is 3.6 : http://www.phpunit.de/manual/3.6/en/installation.html
P.S.
Make sure that PEAR itself is up-to-date. And try installing some other simple package first -- maybe it's PEAR issue (unable to create temp/cache file; firewall issue; missing extension (unlikely) or something else).
:O i surpriced. I found this command and used it. pear list.
i supriced becouse i did a update last week.
this is not v2.3 not 3.6 it it tells me v1.7.2 :O
timestamp 12-08-06_18-10
>pear list
INSTALLED PACKAGES, CHANNEL PEAR.PHP.NET:
=========================================
PACKAGE VERSION STATE
Archive_Tar 1.3.2 stable
Console_Getopt 1.2.3 stable
PEAR 1.7.2 stable
timestamp 12-08-06_18-12
...>pear upgrade pear
downloading PEAR-1.9.4.tgz ...
Starting to download PEAR-1.9.4.tgz (296,332 bytes)
.............................................................done: 296,332 bytes
downloading Archive_Tar-1.3.10.tgz ...
Starting to download Archive_Tar-1.3.10.tgz (18,294 bytes)
...done: 18,294 bytes
downloading Structures_Graph-1.0.4.tgz ...
Starting to download Structures_Graph-1.0.4.tgz (30,318 bytes)
...done: 30,318 bytes
downloading Console_Getopt-1.3.1.tgz ...
Starting to download Console_Getopt-1.3.1.tgz (4,471 bytes)
...done: 4,471 bytes
downloading XML_Util-1.2.1.tgz ...
Starting to download XML_Util-1.2.1.tgz (17,729 bytes)
...done: 17,729 bytes
Warning: require_once(Structures/Graph.php): failed to open stream: No such file
or directory in PEAR\Downloader.php on line 1192
12-08-06_18-14 but then update show no resolt. version numer not changed:
...>pear list
INSTALLED PACKAGES, CHANNEL PEAR.PHP.NET:
=========================================
PACKAGE VERSION STATE
Archive_Tar 1.3.2 stable
Console_Getopt 1.2.3 stable
PEAR 1.7.2 stable
?:|
Here they tell me http://pear.php.net/package/PEAR/redirected 1.9 is stable realease.
its little strange. they tell me 1.9.4 is actually version. but after update its still 1.7.2 :^O
I was referring to PHPUnit manual
1. Try pear clear-caches
2. Usually (as far as I understood from topics on stackoverflow.com) this means that you have more than one pear installation
I suggest -- uninstall PEAR completely and make brand new fresh install (search for uninstall instructions on internet; delete all possible PEAR instances that you may have right now).
BTW -- pear list -a will show ALL installed packages from ALL channels, not just default channel as pear list does.
thanks. BTW i manually installed last days sebastianbergmann-phpunit-3.6.12-0-g4c39b23
it seems to be only one pear version installed:
...:\Windows\system32>pear list -a
INSTALLED PACKAGES, CHANNEL __URI:
==================================
(no packages installed)
INSTALLED PACKAGES, CHANNEL DOC.PHP.NET:
========================================
(no packages installed)
INSTALLED PACKAGES, CHANNEL PEAR.PHP.NET:
=========================================
PACKAGE VERSION STATE
Archive_Tar 1.3.2 stable
Console_Getopt 1.2.3 stable
PEAR 1.7.2 stable
INSTALLED PACKAGES, CHANNEL PEAR.PHPUNIT.DE:
============================================
(no packages installed)
INSTALLED PACKAGES, CHANNEL PEAR.SYMFONY-PROJECT.COM:
=====================================================
(no packages installed)
INSTALLED PACKAGES, CHANNEL PECL.PHP.NET:
=========================================
(no packages installed)
BTW
i am totally frustrated with this shit installing procedure of this phpunit. how could it be to create a tool where installing is such a difficult think? i relly could not imaging such a shit.
it drives me crazy. nothing works. installing not works. deinstalling not wokrs ( it tells nothing is installed :^O
its terrible.
and if i could get it run here so its also not useful, when its noch easy installed by custummer. it have to be quhick.
i will switch to selenium ide firefox plugin. hopefully . i could do the most there.
X-( sorry. terrible
Well .. what can I say --- you are among those 1% (or whatever the number is) who are unlucky to have troubles with PEAR. I'm one of the lucky 99% (or so) who had no issues having it installed and working.
yes thanks for your participation. it really helps. and thats now joke. maybe i should set up a totally new os and throw this machine out of the window. ;) X-( i dont want to give up with it , but it wasting all my time. it dosen't make since so. its bad. may another time. in 100 years ;)