hjfcb Hfhbv
hjfcb Hfhbv

Reputation: 61

set unit test symfony

Actually I exposed my question here : test a repository in symfony But When setting a test for my repository, I get the following result:

Time: 4 seconds, Memory: 18.25Mb

OK, but incomplete or skipped tests!
Tests: 76, Assertions: 183, Skipped: 9.

Is the test ok or not ok and what does assertion mean? Why does he skip some tests??

Upvotes: 2

Views: 102

Answers (1)

Wouter J
Wouter J

Reputation: 41934

Is the test ok?

Yes, the tests are OK ("OK, but incomplete or skipped tests").

what does assertion mean?

Assertions are expectations that are done in a test. For instance:

class CalculatorTest extends \PHPUnit_Framework_TestCase
{
    public function testSum()
    {
        $calculator = new Calculator();

        $this->assertEquals(5, $calculator->sum(2, 3));
        $this->assertEquals(19, $calculator->sum(14, 2, 3));
    }
}

In this code, we have 1 test (testSum) and 2 assertions (2 times assertEquals).

Why does he skip some tests?

Symfony relies on some third party libraries or PHP extensions which may not be installed. When it isn't installed, you can't test it. Thus markes Symfony the test as skipped. For instance:

class LocaleTypeTest extends \PHPUnit_Framework_TestCase
{
    public function setUp()
    {
        if (!extension_loaded('php_intl')) {
            $this->markTestSkipped('Failed to run LocaleType tests, as intl is missing.');
        }
    }
}

Upvotes: 2

Related Questions