Forums / Developer / EZ Unit Tests / Comment51071

Author Topic

Marouane Mighri

Monday 04 May 2009 10:39:19 am

Comment51071

by ignoring some lines in the file “tests/tests/kernel/suite.php”

        $this->addTestSuite( 'eZContentObjectRegression' );
        $this->addTestSuite( 'eZURLAliasMlTest' );
        //$this->addTestSuite( 'eZURLAliasMlRegression' );
        //$this->addTestSuite( 'eZURLTypeRegression' );
        //$this->addTestSuite( 'eZXMLTextRegression' );
        //$this->addTestSuite( 'eZApproveTypeRegression' );
        //$this->addTestSuite( 'eZMultiPriceTypeRegression' );
        //$this->addTestSuite( 'eZContentObjectStateTest' );
        $this->addTestSuite( 'eZContentObjectStateGroupTest' );

I could launch the tests partially, but I have always the same error message:

root@marouane# php tests/runtests.php -D mysql://login:password@host/db
PHPUnit 3.3.16 by Sebastian Bergmann.

.....F....F.................................................  60 / 400
............................................................ 120 / 400
............................................................ 180 / 400
............................................................ 240 / 400
............................................................ 300 / 400
............................................................ 360 / 400
.....................SSSSS..............

Time: 21 seconds

There were 2 failures:

1) testGetChildren(eZURLAliasMlTest)
Failed asserting that <integer:0> matches expected value <integer:2>.

2) testChoosePrioritizedRow(eZURLAliasMlTest)
Failed asserting that <string:2> matches expected value <integer:4>.

FAILURES!
Tests: 400, Assertions: 453, Failures: 2, Skipped: 5.

bychanging value of “language” in function “testGetChildren” in file "tests/tests/kernel/classes/urlaliasml_test.php", the unitest works!

    public function testGetChildren()
    {
        $action = "eznode:" . mt_rand();

        -- $parent = eZURLAliasML::create( __FUNCTION__ . "Parent", $action, 1, 2 );
		++ $parent = eZURLAliasML::create( __FUNCTION__ . "Parent", $action, 1, 1 );
        $parent->store();

        -- $child1 = eZURLAliasML::create( __FUNCTION__ . "Child1", $action, $parent->ID, 2 );
        ++ $child1 = eZURLAliasML::create( __FUNCTION__ . "Child1", $action, $parent->ID, 1 );
        $child1->store();

        -- $child2 = eZURLAliasML::create( __FUNCTION__ . "Child2", $action, $parent->ID, 2 );
        ++ $child2 = eZURLAliasML::create( __FUNCTION__ . "Child2", $action, $parent->ID, 1 );
        $child2->store();

        -- $child3 = eZURLAliasML::create( __FUNCTION__ . "Child3", $action, $parent->ID, 4 );
        ++ $child3 = eZURLAliasML::create( __FUNCTION__ . "Child3", $action, $parent->ID, 3 );
        $child3->store();

        $children = $parent->getChildren();

        // Number of children should be 2 (child3 has different language and
        // should not be included in getChildren()).
        self::assertEquals( 2, count( $children ) );

        self::assertEquals( (int) $child1->attribute( 'id' ), (int) $children[0]->attribute( 'id' ) );
        self::assertEquals( (int) $child2->attribute( 'id' ), (int) $children[1]->attribute( 'id' ) );
    }

Somebody would have some explanations for this ?

Thanks

Maecia