Welcome Guest, Not a member yet? Register   Sign In
How proper unit test
#2

(10-03-2018, 01:46 AM)Przem4S Wrote: Hello Smile

So, I have problem with testing.

Firstly - yes I read Testing Section in CI4 Docs

When I run simply "phpunit" in CI4 directory I have error:

Class `CodeIgniter\Test\CIUnitTestCase` not found in (...)\tests\_support\CIUnitTestCase.php on line 5

What's wrong? Composer update run with no-complications.

All works fine for me.

composer create-project codeigniter4/framework:dev-develop mysuperapp
cd mysuperapp && composer install
ln -s ./vendor/bin/phpunit ./phpunit

Create the file tests/TestFoo.php:
PHP Code:
<?php

class TestFoo extends \CodeIgniter\Test\CIUnitTestCase
{
    
/**
     * @test
     */
    
public function testBar()
    {
        
$this->assertEquals(12);
    }


Execute the test with this command:
Code:
./phpunit tests/TestFoo.php --filter bar

[Image: Qto2Fkh.png]
Reply


Messages In This Thread
How proper unit test - by Przem4S - 10-03-2018, 01:46 AM
RE: How proper unit test - by unodepiera - 10-04-2018, 12:39 PM
RE: How proper unit test - by Przem4S - 10-08-2018, 01:36 AM
RE: How proper unit test - by unodepiera - 10-08-2018, 08:44 AM
RE: How proper unit test - by Przem4S - 10-09-2018, 01:00 AM
RE: How proper unit test - by Przem4S - 10-16-2018, 03:51 AM
RE: How proper unit test - by puschie - 10-19-2018, 12:24 AM



Theme © iAndrew 2016 - Forum software by © MyBB