0
votes

I´m trying to configure the fixtures and phpunit system is returned the next message '.E', but I don´t know how interpret it:

C:\kyopol\Apache 2.22.22\htdocs\demo\protected\tests>phpunit unit/EntityTest.php

PHPUnit 3.7.14 by Sebastian Bergmann.

Configuration read from C:\kyopol\Apache 2.22.22\htdocs\demo\protected\tests\phpunit.xml

.E

Time: 2 seconds, Memory: 6.50Mb

There was 1 error:

1) EntityTest::testRead Undefined variable: newEntity

C:\kyopol\Apache 2.22.22\htdocs\demo\protected\tests\unit\EntityTest.php:37

FAILURES! Tests: 2, Assertions: 3, Errors: 1.

Next, class test EntityTest.php data code:

class EntityTest extends CDbTestCase
{   
public function testCreate()
{
    //CREATE a new Entity
    $newEntity=new Entity;
    $newEntity->setAttributes(
        array(
                'name' => 'Test Entity 1',
                'description' => 'Test entity number one',
                'type_id' => 1,
                'location_lat' => 77,
                'location_lon' => 77,
                'create_time' => '2013-02-16 20:36:00',
                'create_user_id' => 1,
                'update_time' => '0000-00-00 00:00:00',
                'update_user_id' => 0,
            )
    );
    $this->assertTrue($newEntity->save(false));

    //READ a Entity
    $retrievedEntity=Entity::model()->findByPk($newEntity->id);
    $this->assertTrue($retrievedEntity instanceof Entity);
    $this->assertEquals('Test Entity 1',$retrievedEntity->name);
}

public function testRead()
    {
        //READ a Entity
        $retrievedEntity=Entity::model()->findByPk($newEntity->id);
        $this->assertTrue($retrievedEntity instanceof Entity);
        $this->assertEquals('Test Entity 1',$retrievedEntity->name);
    }
}

What is it meaning the capital letter 'E' and the previous point '.' ?

In general: Could nobody said me how knows to interpret output messages in phpunit?

Cheers.

1

1 Answers

1
votes

One of your tests is failing so that's why you see the E. The other one is passing, indicated by a .. If there are any error messages in the tests they will be summarized at the end.

The error message of your failing test is "Undefined variable: newEntity".

Your first line in testRead() is:

$retrievedEntity=Entity::model()->findByPk($newEntity->id);

But you have never setup $newEntity in that test.