FAQ
Hello,

Please be sure that all package maintainers are inactive before to do
something on source.

Reason, is I was surprised to see directory structure change on
Net_Growl package, when I'm going to prepare new version 2.5.0.

And I'm not sure this is the right solution applied here.

First : You missed a file
pear/packages/Net_Growl/trunk/tests/AllTests.php , that didn't use the
new dir structure

Second: I don't think to use autoloader in each test file solve the
"trying to install version".

With path like 'Net/Growl/Autoload.php' you will use the installed
version in system of Net_Growl and not the SVN working copy

Regards
Laurent Laville

Still active Net_Growl package leader


-------- Message original --------
Sujet: svn: /pear/packages/Net_Growl/trunk/tests/Growl/
ApplicationTest.php GntpMockTest.php GntpTest.php gntp.log
Date : Sun, 01 Jan 2012 14:44:00 +0000
De : danielc@php.net (Daniel Convissor)
Pour : pear-cvs@lists.php.net
Groupes de discussion: php.pear.cvs

danielc Sun, 01 Jan 2012 14:44:00 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=321638

Log:
Require the autoloader in the test files so the class files will be found.

Changed paths:
U pear/packages/Net_Growl/trunk/tests/Growl/ApplicationTest.php
U pear/packages/Net_Growl/trunk/tests/Growl/GntpMockTest.php
U pear/packages/Net_Growl/trunk/tests/Growl/GntpTest.php
U pear/packages/Net_Growl/trunk/tests/Growl/gntp.log

Search Discussions

  • Daniel O'Connor at Jan 3, 2012 at 9:54 am


    And I'm not sure this is the right solution applied here.

    http://test.pear.php.net:8080/job/Net_Growl/
    For some time, no tests could execute.

    Having a 'Net' and executing the tests from the top level dir means that
    the include_path of . will pick up the right files - you can see build #10
    started working.
  • Laurent Laville at Jan 3, 2012 at 11:12 am
    Le 03/01/2012 10:54, Daniel O'Connor a écrit :

    And I'm not sure this is the right solution applied here.

    http://test.pear.php.net:8080/job/Net_Growl/

    For some time, no tests could execute.

    Having a 'Net' and executing the tests from the top level dir means
    that the include_path of . will pick up the right files - you can see
    build #10 started working.
    Of course the include_path may solve this issue, tests suites may failed
    on others machine if include_path is not set as expected.

    I prefer to use a solution like the XML phpunit configuration file

    With such mini content

    <phpunit bootstrap="../Net/Growl/Autoload.php">

    </phpunit>

    And launcher, for example like :

    C:\home\pear\Net_Growl\trunk>phpunit -c tests/phpunit.xml tests/
    PHPUnit 3.6.7 by Sebastian Bergmann.

    Configuration read from C:\home\pear\Net_Growl\trunk\tests\phpunit.xml

    .....................

    Time: 1 second, Memory: 5.00Mb

    OK (21 tests, 82 assertions)

    What do you think of this proposal ?
  • Daniel Convissor at Jan 3, 2012 at 6:49 pm
    Hi Laurent:

    Please accept my apologies for stepping on your toes. You're right, I
    should have contacted you.

    And I'm not sure this is the right solution applied here.
    First : You missed a file
    pear/packages/Net_Growl/trunk/tests/AllTests.php , that didn't use
    the new dir structure
    That file picks up the autoload file from the included test files.

    With path like 'Net/Growl/Autoload.php' you will use the installed
    version in system of Net_Growl and not the SVN working copy
    PEAR's tests should be configured to (at least) run properly from the
    base directory of the package's checkout, so in a structure like this:

    Net_Growl
    Net_Growl/Net
    Net_Growl/Net/Growl
    Net_Growl/tests

    One cd's into Net_Growl and calls the tests via one of the following
    ways, for example, depending on the way tests are set up:
    phpunit tests
    phpunit tests/AllTests.php
    pear run-tests -r tests

    This way the "." in the include path pick up the "Net" and "Net/Growl"
    directories so local files are found, as desired.

    In some test suites, such as pear-core, I hard code the include path based on
    whether one is in a checkout or an installation. This permits one to
    run the tests from any location, which can be helpful if there are lots
    of tests and/or test sub-directories.

    I prefer to use a solution like the XML phpunit configuration file
    <phpunit bootstrap="../Net/Growl/Autoload.php">
    This approach has problems. If you put the file inside the tests dir,
    it does not get picked up when running "phpunit tests" from the
    Net_Growl directory, as is the normal practice. If you put the
    phpunit.xml in the Net_Growl directory, where will that end up when
    installed and what will happen when running "pear run-tests" for the
    installed package?

    C:\home\pear\Net_Growl\trunk>phpunit -c tests/phpunit.xml tests/
    While the package's particular Jenkins build commands can be set up to
    run the tests like that, that doesn't solve the problem for random
    developers who are just trying to run the tests on an ad hoc basis in
    their personal checkouts. Plus it's a custom configuration for Jenkins,
    so the more packages that do that, the more complex things get to
    manage.

    Thanks,

    --Dan

    --
    T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y
    data intensive web and database programming
    http://www.AnalysisAndSolutions.com/
    4015 7th Ave #4, Brooklyn NY 11232 v: 718-854-0335 f: 718-854-0409

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppear-qa @
categoriesphp
postedJan 3, '12 at 9:19a
activeJan 3, '12 at 6:49p
posts4
users3
websitepear.php.net

People

Translate

site design / logo © 2022 Grokbase