vendredi 24 juin 2016

Can't execute test case due to error 'Class not found'

I have installed PHPUnit as part of my project using Composer (not globaly but under vendor/ dir). I have made this little test case:

<?php

namespace test;

use data\address\Address;
use lists\Collection;
use PHPUnit\Framework\TestCase;

class CollectionTest extends TestCase
{
    public function testIsCollectionOf()
    {
        $Collection = new Collection(Address::class);
        $this->assertInstanceOf($Collection, $Collection);
    }
}

Any time I try I end up with this error:

./phpunit /var/www/alpha/test/CollectionTest.php 
PHPUnit 5.4.6 by Sebastian Bergmann and contributors.

E                                                                   1 / 1 (100%)

Time: 32 ms, Memory: 2.00MB

There was 1 error:

1) test\CollectionTest::testIsCollectionOf
Error: Class 'lists\Collection' not found

/var/www/alpha/test/CollectionTest.php:17

ERRORS!
Tests: 1, Assertions: 0, Errors: 1.

I don't know if I am missing something or if so what is it. I am using the default phpunit.xml under vendor/phpunit/phpunit/phpunit (don't know if this help). What I am missing?

Aucun commentaire:

Enregistrer un commentaire