Jump to:

23358 Posts in 17875 Topics by 2862 members

General Questions

SilverStripe Forums » General Questions » PHPUnit on windows

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 3869 Views
  • Pike
    Avatar
    Community Member
    40 Posts

    PHPUnit on windows Link to this post

    Hi guys,

    Can somebody help me with PHPUnit and SS 2.4.2?
    My primary OS is windows 7 ultimate 64-bit, my secondary OS is Ubuntu 10.10. On Ubuntu is all OK.

    I’ve troubles only on windows 7: all 32-bit: Apache/2.2.15 (Win32) DAV/2 PHP/5.2.13 mod_ssl/2.2.15 OpenSSL/0.9.8m mod_perl/2.0.4 Perl/v5.10.1, mysql 5.1.51.

    I spent whole weekend to setup php with CLI ( I don’t want see shit error “CLI stopped working”).
    I tested php versions:
    5.3.3    - I cannot connect to mysql
    5.3.2   - I cannot connect to mysql
    5.3.1   - I can connect to mysql, but I cannot resolve error “CLI stopped working“
    5.2.13   - OK. I can connect to mysql , I solved error “CLI stopped working“ (reason: soap.dll).
    I install pear.

    INSTALLED PACKAGES, CHANNEL PEAR.PHP.NET:
    =========================================
    PACKAGE VERSION STATE
    Archive_Tar 1.3.7 stable
    Console_Color 1.0.2 stable
    Console_Getargs 1.3.5 stable
    Console_Getopt 1.2.3 stable
    Console_Table 1.1.3 stable
    Event_Dispatcher 1.1.0 stable
    File_Find 1.3.1 stable
    HTML_Common 1.2.5 stable
    HTML_Table 1.8.3 stable
    MDB2 2.4.1 stable
    MDB2_Driver_mysql 1.4.1 stable
    MDB2_Driver_mysqli 1.4.1 stable
    PEAR 1.9.1 stable
    PHPUnit 1.3.2 stable
    PHP_CompatInfo 1.9.0 stable
    PhpDocumentor 1.4.3 stable
    Structures_Graph 1.0.3 stable
    Var_Dump 1.0.4 stable
    XML_Beautifier 1.2.0 stable
    XML_Parser 1.3.2 stable
    XML_Util 1.2.1 stable

    As CLI work php phpunit StackTest (.php).
    But when I want try http://www.silverstripedev.sk.loc/dev/tests, I see only error:

    [User Notice] Please no longer include "PHPUnit/Framework.php".
    GET /dev/tests
    Line 50 in E:\php\PEAR\PHPUnit\Framework.php
    Source
    41 * @link http://www.phpunit.de/
    42 * @since File available since Release 3.0.0
    43 */
    44
    45 require_once 'PHP/CodeCoverage/Filter.php';
    46 PHP_CodeCoverage_Filter::getInstance()->addFileToBlacklist(__FILE__, 'PHPUNIT');
    47
    48 trigger_error(
    49 'Please no longer include "PHPUnit/Framework.php".', E_USER_NOTICE
    50 );
    Trace
    •   trigger_error(Please no longer include "PHPUnit/Framework.php".,1024)
    Line 50 of Framework.php
    •   require_once(E:\php\PEAR\PHPUnit\Framework.php)
    Line 20 of TestRunner.php
    •   include_once(E:\Www\www.silverstripedev.sk\sapphire\dev\TestRunner.php)
    Line 300 of Core.php
    •   __autoload(TestRunner)
    •   ReflectionClass->__construct(TestRunner)
    Line 89 of Object.php
    •   Object::create(TestRunner)
    Line 108 of DevelopmentAdmin.php
    •   DevelopmentAdmin->tests(SS_HTTPRequest)
    Line 137 of RequestHandler.php
    •   RequestHandler->handleRequest(SS_HTTPRequest)
    Line 147 of Controller.php
    •   Controller->handleRequest(SS_HTTPRequest)
    Line 281 of Director.php
    •   Director::handleRequest(SS_HTTPRequest,Session)
    Line 124 of Director.php
    •   Director::direct(/dev/tests)
    Line 127 of main.php

    Where is problem, what I’m doing wrong?

    Today:
    I upgraded php to 5.3.1 and I found this article: http://youtrack.jetbrains.net/issue/WI-3326?projectKey=WI&query=phpunit, today.
    So I made changes:

    in /sapphire/dev/TestRunner.php

    if(hasPhpUnit()) {
    //require_once 'PHPUnit/Framework.php';
    //require_once 'PHPUnit/Util/Report.php';
    //require_once 'PHPUnit/TextUI/TestRunner.php';
    require_once 'PHPUnit/Autoload.php';
    }

    and

    in /sapphire/dev/SapphireTest.php

    if(hasPhpUnit()) {
    //require_once 'PHPUnit/Framework.php';
    require_once 'PHPUnit/Autoload.php';
    }

    I see screen with links to tests after /dev/tests, but after clik to any link I got error:

    Fatal error: Class 'PHPUnit_Framework_TestCase' not found in E:\Www\www.silverstripedev.sk\sapphire\dev\SapphireTest.php on line 15

    I NEED HELP!!!!!!!!!

    Attached Files
  • Sean
    Avatar
    Forum Moderator
    921 Posts

    Re: PHPUnit on windows Link to this post

    My usual process to install PHP, PEAR and then PHPUnit on Windows is as follows:

    1. Download PHP "Zip" link for appropriate version you need from here: http://windows.php.net/download
    2. Extract the Zip contents to C:\php5 or wherever you would like PHP installed
    3. Rename the php.ini-development to php.ini and edit it, enable extensions etc
    4. Open command line as an administrator, browse to where you extracted PHP and type go-pear.bat to install PEAR
    5. Install PHPUnit using the instructions here: http://www.phpunit.de/manual/current/en/installation.html

    Using the above steps, I've always been able to get it working without any trouble.

    Sean

  • swaiba
    Avatar
    Forum Moderator
    1784 Posts

    Re: PHPUnit on windows Link to this post

    @ Sean - So you do not use the wamp version of PHP?
    (I ask because wamp downloads and installs the zip for us)

  • Pike
    Avatar
    Community Member
    40 Posts

    Re: PHPUnit on windows Link to this post

    You are happy man!

  • Pike
    Avatar
    Community Member
    40 Posts

    Re: PHPUnit on windows Link to this post

    I'm using xampp cca 7 years......

  • Sean
    Avatar
    Forum Moderator
    921 Posts

    Re: PHPUnit on windows Link to this post

    swaiba: Not if I'm working with IIS on Windows, as the PHP version that comes with XAMMP or WAMP is thread safe, and a VC6 compile.

    3869 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.