Using PHPUnit2

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jacob Atzen

    Using PHPUnit2

    Howdy,

    For the last couple of days I've been trying to get PHPUnit2 (the one
    from Pear) working on my system.

    I have read the documentation over and over but still can't get any
    tests to run. I've created the following trivial piece of testcode and
    put it in TrueTest.php. When I try to run 'phpunit TrueTest' nothing
    happens, the same with 'phpunit TrueTest.php' and 'phpunit TrueTest
    TrueTest.php'. If I run phpunit without arguments I get the expected
    help information. What am I missing?

    <?php

    require_once 'PHPUnit2/Framework/TestCase.php';
    require_once 'controller/frontcontroller .php';

    class TrueTest extends PHPUnit2_Framew ork_TestCase {

    public function __construct($st ring) {
    parent::__const ruct($string);
    }

    public function testTrue() {
    self::assertTru e(true);
    }

    }

    $suite = new PHPUnit2_Framew ork_TestSuite(' TrueTest');
    $result = $suite->run();

    ?>

    --
    Med venlig hilsen
    - Jacob Atzen
  • Jacob Atzen

    #2
    Re: Using PHPUnit2

    On 2005-04-05, Jacob Atzen <jacob@aub.dk > wrote:[color=blue]
    > For the last couple of days I've been trying to get PHPUnit2 (the one
    > from Pear) working on my system.
    >
    > I have read the documentation over and over but still can't get any
    > tests to run. I've created the following trivial piece of testcode and
    > put it in TrueTest.php. When I try to run 'phpunit TrueTest' nothing
    > happens, the same with 'phpunit TrueTest.php' and 'phpunit TrueTest
    > TrueTest.php'. If I run phpunit without arguments I get the expected
    > help information. What am I missing?[/color]

    Apparently I was missing some undocumented use patterns. For future
    reference it's easier to use the --skeleton on an existing class.
    Something along the lines of 'phpunit --skeleton [classname]'.

    --
    Cheers
    - Jacob Atzen

    Comment

    • Henk Verhoeven

      #3
      Re: Using PHPUnit2

      Jacob Atzen wrote:
      [color=blue]
      > On 2005-04-05, Jacob Atzen <jacob@aub.dk > wrote:
      >[color=green]
      >>For the last couple of days I've been trying to get PHPUnit2 (the one
      >>from Pear) working on my system.
      >>
      >>I have read the documentation over and over but still can't get any
      >>tests to run. I've created the following trivial piece of testcode and
      >>put it in TrueTest.php. When I try to run 'phpunit TrueTest' nothing
      >>happens, the same with 'phpunit TrueTest.php' and 'phpunit TrueTest
      >>TrueTest.php' . If I run phpunit without arguments I get the expected
      >>help information. What am I missing?[/color]
      >
      >
      > Apparently I was missing some undocumented use patterns. For future
      > reference it's easier to use the --skeleton on an existing class.
      > Something along the lines of 'phpunit --skeleton [classname]'.
      >[/color]
      Do you mean you got it working? If you don't, you could try pnt/unit,
      see http://www.phppeanuts.org/examples/pntUnit/index.php
      (It is undocumeted, included in the framework download, but you do not
      need the framework to run it (would'nt be of much use for testing the
      framework it errors in the framework could break the unit testing tool ;-)

      Greetings,

      Henk Verhoeven.

      Comment

      • Jacob Atzen

        #4
        Re: Using PHPUnit2

        On 2005-04-06, Henk Verhoeven <news1@phppeanu tsREMOVE-THIS.org> wrote:[color=blue]
        > Do you mean you got it working? If you don't, you could try pnt/unit,
        > see http://www.phppeanuts.org/examples/pntUnit/index.php
        > (It is undocumeted, included in the framework download, but you do not
        > need the framework to run it (would'nt be of much use for testing the
        > framework it errors in the framework could break the unit testing tool
        > ;-)[/color]

        Yes, I finally managed to run some tests with PHPUnit2.

        --
        Cheers,
        - Jacob Atzen

        Comment

        Working...