Skip to content

Getting Sample TDD Code in Github Repo to work with Laravel 6.x #1

@connecteev

Description

@connecteev

Note: cross-posted to https://devlob.com/forum/question/getting-sample-tdd-code-in-github-repo-to-work-with-laravel-6x

I found your youtube playlist on TDD and really loved the series.
I then went on to try the sample code you had linked to in your Github repo:
https://github.com/devlob/apis-in-laravel-using-tdd

Everything works ok on running php unit, until I try to port these tests (as a starting point) into my own Laravel 6.x application

devlob_apis_in_laravel_using_tdd % ./vendor/bin/phpunit tests/Feature
PHPUnit 7.4.4 by Sebastian Bergmann and contributors.

................                                                  16 / 16 (100%)

Time: 4.97 seconds, Memory: 28.00MB

OK (16 tests, 92 assertions)

I also tried copying the files in tests/Feature into a fresh laravel 6.x application, and the tests fail. ANy ideas? Here's the output:

% ./vendor/bin/phpunit tests/Feature
PHPUnit 8.5.1 by Sebastian Bergmann and contributors.

.EF                                                                 3 / 3 (100%)

Time: 354 ms, Memory: 24.00 MB

There was 1 error:

1) Tests\Feature\Http\Controllers\Auth\AuthControllerTest::can_authenticate
Error: Call to undefined method Tests\Feature\Http\Controllers\Auth\AuthControllerTest::create()

/Users/kp/TDD/test_tdd/tests/Feature/Http/Controllers/Auth/AuthControllerTest.php:27

--

There was 1 failure:

1) Tests\Feature\Http\Controllers\Auth\AuthControllerTest::can_authenticate_using_google
Expected status code 302 but received 404.
Failed asserting that false is true.

/Users/kp/TDD/test_tdd/vendor/laravel/framework/src/Illuminate/Foundation/Testing/TestResponse.php:185
/Users/kp/TDD/test_tdd/tests/Feature/Http/Controllers/Auth/AuthControllerTest.php:56

ERRORS!
Tests: 3, Assertions: 8, Errors: 1, Failures: 1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions