Mittwoch, 28. November 2012

Probleme mit PHPUnit

Bei mir lief das aktualisieren der PHPUnit nicht. Es kam immer die folgende Ausgabe:

PHP Deprecated:  Assigning the return value of new by reference is deprecated in
 C:\xampp\php\PEAR\PEAR\Config.php on line 650

Deprecated: Assigning the return value of new by reference is deprecated in C:\x
ampp\php\PEAR\PEAR\Config.php on line 650
PHP Deprecated:  Assigning the return value of new by reference is deprecated in
 C:\xampp\php\PEAR\PEAR\Config.php on line 697

Deprecated: Assigning the return value of new by reference is deprecated in C:\x
ampp\php\PEAR\PEAR\Config.php on line 697
PHP Deprecated:  Assigning the return value of new by reference is deprecated in
 C:\xampp\php\PEAR\PEAR\Config.php on line 757

Deprecated: Assigning the return value of new by reference is deprecated in C:\x
ampp\php\PEAR\PEAR\Config.php on line 757
PHP Deprecated:  Assigning the return value of new by reference is deprecated in
 C:\xampp\php\PEAR\PEAR\Config.php on line 786

Deprecated: Assigning the return value of new by reference is deprecated in C:\x
ampp\php\PEAR\PEAR\Config.php on line 786
PHP Deprecated:  Assigning the return value of new by reference is deprecated in
 C:\xampp\php\PEAR\PEAR\Config.php on line 914

Deprecated: Assigning the return value of new by reference is deprecated in C:\x
ampp\php\PEAR\PEAR\Config.php on line 914
PHP Deprecated:  Assigning the return value of new by reference is deprecated in
 C:\xampp\php\PEAR\PEAR\Config.php on line 1577

Deprecated: Assigning the return value of new by reference is deprecated in C:\x
ampp\php\PEAR\PEAR\Config.php on line 1577
PHP Deprecated:  Assigning the return value of new by reference is deprecated in
 C:\xampp\php\PEAR\PEAR\Config.php on line 1607

Deprecated: Assigning the return value of new by reference is deprecated in C:\x
ampp\php\PEAR\PEAR\Config.php on line 1607
PHP Deprecated:  Assigning the return value of new by reference is deprecated in
 C:\xampp\php\PEAR\PEAR\Config.php on line 2038

Deprecated: Assigning the return value of new by reference is deprecated in C:\x
ampp\php\PEAR\PEAR\Config.php on line 2038
PHP Deprecated:  Assigning the return value of new by reference is deprecated in
 C:\xampp\php\PEAR\PEAR\Config.php on line 2091

Deprecated: Assigning the return value of new by reference is deprecated in C:\x
ampp\php\PEAR\PEAR\Config.php on line 2091
PHP Deprecated:  Assigning the return value of new by reference is deprecated in
 C:\xampp\php\PEAR\PEAR\Registry.php on line 322

Deprecated: Assigning the return value of new by reference is deprecated in C:\x
ampp\php\PEAR\PEAR\Registry.php on line 322
PHP Deprecated:  Assigning the return value of new by reference is deprecated in
 C:\xampp\php\PEAR\PEAR\Registry.php on line 1450

Deprecated: Assigning the return value of new by reference is deprecated in C:\x
ampp\php\PEAR\PEAR\Registry.php on line 1450
PHP Deprecated:  Assigning the return value of new by reference is deprecated in
 C:\xampp\php\PEAR\PEAR\Registry.php on line 1458

Deprecated: Assigning the return value of new by reference is deprecated in C:\x
ampp\php\PEAR\PEAR\Registry.php on line 1458
PHP Strict Standards:  Non-static method System::tmpdir() should not be called s
tatically in C:\xampp\php\PEAR\PEAR\Config.php on line 158

Strict Standards: Non-static method System::tmpdir() should not be called static
ally in C:\xampp\php\PEAR\PEAR\Config.php on line 158
PHP Strict Standards:  Non-static method System::tmpdir() should not be called s
tatically in C:\xampp\php\PEAR\PEAR\Config.php on line 167

Strict Standards: Non-static method System::tmpdir() should not be called static
ally in C:\xampp\php\PEAR\PEAR\Config.php on line 167
PHP Strict Standards:  Non-static method System::tmpdir() should not be called s
tatically in C:\xampp\php\PEAR\PEAR\Config.php on line 176

Strict Standards: Non-static method System::tmpdir() should not be called static
ally in C:\xampp\php\PEAR\PEAR\Config.php on line 176
PHP Strict Standards:  Non-static method System::which() should not be called st
atically in C:\xampp\php\PEAR\PEAR\Config.php on line 229

Strict Standards: Non-static method System::which() should not be called statica
lly in C:\xampp\php\PEAR\PEAR\Config.php on line 229
PHP Strict Standards:  Non-static method Console_Getopt::getopt() should not be
called statically, assuming $this from incompatible context in C:\xampp\php\PEAR
\PHPUnit2\TextUI\TestRunner.php on line 154

Strict Standards: Non-static method Console_Getopt::getopt() should not be calle
d statically, assuming $this from incompatible context in C:\xampp\php\PEAR\PHPU
nit2\TextUI\TestRunner.php on line 154
PHP Strict Standards:  Non-static method Console_Getopt::doGetopt() should not b
e called statically, assuming $this from incompatible context in C:\xampp\php\PE
AR\Console\Getopt.php on line 78

Strict Standards: Non-static method Console_Getopt::doGetopt() should not be cal
led statically, assuming $this from incompatible context in C:\xampp\php\PEAR\Co
nsole\Getopt.php on line 78
PHP Strict Standards:  Non-static method PEAR::isError() should not be called st
atically, assuming $this from incompatible context in C:\xampp\php\PEAR\Console\
Getopt.php on line 87

Strict Standards: Non-static method PEAR::isError() should not be called statica
lly, assuming $this from incompatible context in C:\xampp\php\PEAR\Console\Getop
t.php on line 87
PHP Strict Standards:  Non-static method PEAR::isError() should not be called st
atically, assuming $this from incompatible context in C:\xampp\php\PEAR\PHPUnit2
\TextUI\TestRunner.php on line 160

Strict Standards: Non-static method PEAR::isError() should not be called statica
lly, assuming $this from incompatible context in C:\xampp\php\PEAR\PHPUnit2\Text
UI\TestRunner.php on line 160
PHPUnit 2.3.6 by Sebastian Bergmann.

Usage: phpunit [switches] UnitTest [UnitTest.php]
  --testdox-html   Write agile documentation in HTML format to file.
  --testdox-text   Write agile documentation in Text format to file.
  --log-xml        Log test progress in XML format to file.

  --loader       TestSuiteLoader implementation to use.

  --skeleton             Generate skeleton UnitTest class for Unit in Unit.php.

  --wait                 Waits for a keystroke after each test.

  --help                 Prints this usage information.
  --version              Prints the version and exits.




Um drotzdem Testen zu können habe ich den folgenden Weg gefunden:

Die Datei phpunit.Phar Herunterladen. Dies geht einfach mit Firefox die folgende URL öffen:
http://pear.phpunit.de/get/phpunit.phar (Firefox fragt bei mir dann gleich ober die Datei Speichern soll)

Wenn man dann PHPUnit nutzen möchte ruft man die Datei wie folgt in der Komandozeile(Windows) auf:
php Laufwerk:\pfad_zum_file\phpunit.phar
(Man muß sich nur in dem Verzeichnis befinden, wo die phpunit.xml.dist und bootstrap.php liegen) Die benötigten Dateien vom Test sucht sich das Programm dann selbst zusammen.

Zend Framework2 -Unit Testing - Setting up the tests directory

Für das Unit Testing bzw. die Verzeichnisstruktur erstellen habe ich mir eine kleine Batchdatei geschrieben, die die Verzeichnisstruktur erstellt. Mit dem Inhalt:

md test
md test\ApplicationTest
md test\ApplicationTest\Controller


Diese wird nachdem man die Skeleton Application Installiert hat in dem Verzeichnis
zf2-tutorial2\module\Application ausgeführt.

Die Namen der Verzeichnisse müßen dann noch auf die jeweilige Anwendung angepasst werden.(Also alles was zf2-tutorial2 lautet)

Dienstag, 27. November 2012

pear upgrade - ERROR: failed to Makedir

Will man PEAR aktualisieren kommt es mit unter zu der Meldung "Error: failed to Makedir".

Dies lag bei mir daran, das Windows bzw. Pear das Verzeichnis nicht Richtig zugeordnet hat. Die Lösung:

Die Kommandozeile aufrufen (XP: Start - ausführen: CMD bzw. W7:Start in das Feld CMD eingeben und "Enter" drücken).

In das Installationsverzeichnis (auf jedem Rechner anders) von PHP wechseln:

D:
cd D:\xampp\php
 
Danach die Konfiguration anpassen(nacheinander eingeben oder einfügen und bei dem letzten Bfehl "Enter" drücken):
pear config-set doc_dir d:\xampp\php\pear\docs
pear config-set cfg_dir d:\xampp\php\pear\cfg
pear config-set data_dir d:\xampp\php\pear\data
pear config-set cache_dir d:\xampp\php\pear\cache
pear config-set download_dir d:\xampp\php\pear\download
pear config-set temp_dir d:\xampp\php\pear\temp
pear config-set test_dir d:\xampp\php\pear\tests
pear config-set www_dir d:\xampp\php\pear\www

Nun noch aktualisieren:
pear upgrade pear