Welcome Guest, Not a member yet? Register   Sign In
My first test....
#1

I was going to write my first test ever and failed already... from the docs I found this piece and saved it at tests/app/Libraries/fooTest.php
PHP Code:
<?php

namespace App\Libraries;

use 
CodeIgniter\Test\CIUnitTestCase;

class 
FooTest extends CIUnitTestCase
{
    public function testFooNotBar()
    {
        $response $this->get('/');
    }

When I run the test now via 'vendor/bin/phpunit' I get the error message

Code:
There was 1 error:

1) App\Libraries\FooTest::testFooNotBar
Error: Call to undefined method App\Libraries\FooTest::get()

/var/www/html/bofewo/web/tests/app/Libraries/fooTest.php:11
So apparently I am missing something but not experienced enough to know what. Can someone point me the right direction please?
Reply
#2

Quote:Feature testing requires that all of your test classes use the CodeIgniter\Test\DatabaseTestTrait and CodeIgniter\Test\FeatureTestTrait traits.
https://codeigniter4.github.io/CodeIgnit...test-class
Reply




Theme © iAndrew 2016 - Forum software by © MyBB