Skip to content

Tests fail on master branch #76

@morpheus7CS

Description

@morpheus7CS

Hey @calebporzio,

after cloning the master branch I ran the test suite and this is the output:

➜  livewire-pr git:(master) ✗ ./vendor/bin/phpunit --filter=DestroyCommandTest
PHPUnit 7.5.14 by Sebastian Bergmann and contributors.

FFE                                                                 3 / 3 (100%)

Time: 134 ms, Memory: 18.00 MB

There was 1 error:

1) Tests\DestroyCommandTest::component_is_removed_without_confirmation_if_forced
Mockery\Exception\InvalidCountException: Method askQuestion(<Closure===true>) from Mockery_1_Illuminate_Console_OutputStyle should be called
 exactly 1 times but called 0 times.

/Users/gjakic/Code/livewire-pr/vendor/mockery/mockery/library/Mockery/CountValidator/Exact.php:38
/Users/gjakic/Code/livewire-pr/vendor/mockery/mockery/library/Mockery/Expectation.php:310
/Users/gjakic/Code/livewire-pr/vendor/mockery/mockery/library/Mockery/ExpectationDirector.php:119
/Users/gjakic/Code/livewire-pr/vendor/mockery/mockery/library/Mockery/Container.php:303
/Users/gjakic/Code/livewire-pr/vendor/mockery/mockery/library/Mockery/Container.php:288
/Users/gjakic/Code/livewire-pr/vendor/mockery/mockery/library/Mockery.php:204
/Users/gjakic/Code/livewire-pr/vendor/orchestra/testbench-core/src/Concerns/Testing.php:106
/Users/gjakic/Code/livewire-pr/vendor/orchestra/testbench-core/src/TestCase.php:51

--

There were 2 failures:

1) Tests\DestroyCommandTest::component_is_removed_by_destroy_command
Unexpected question "Are you sure you want to delete the following files?" was asked.

/Users/gjakic/Code/livewire-pr/vendor/laravel/framework/src/Illuminate/Foundation/Testing/PendingCommand.php:139
/Users/gjakic/Code/livewire-pr/vendor/laravel/framework/src/Illuminate/Foundation/Testing/PendingCommand.php:220
/Users/gjakic/Code/livewire-pr/tests/DestroyCommandTest.php:19

2) Tests\DestroyCommandTest::component_is_not_removed_when_confirm_answer_is_no
Unexpected question "Are you sure you want to delete the following files?" was asked.

/Users/gjakic/Code/livewire-pr/vendor/laravel/framework/src/Illuminate/Foundation/Testing/PendingCommand.php:139
/Users/gjakic/Code/livewire-pr/vendor/laravel/framework/src/Illuminate/Foundation/Testing/PendingCommand.php:220
/Users/gjakic/Code/livewire-pr/tests/DestroyCommandTest.php:35

ERRORS!
Tests: 3, Assertions: 14, Errors: 1, Failures: 2.

After playing around it for a while, it seems the test fail as the path to the repository on your local machine is hardcoded inside the test and will, therefore, break on anyone else's machine (and even inside another folder on your own machine).

I have shortened the question to "Are you sure you want to delete the following files?" in my PR commit d057420, omitting the file names entirely, getting all three tests to pass.

I think a better solution would be (something I couldn't figure out how to do myself) for the file output to change from:

/Users/calebporzio/Documents/Code/sites/livewire/vendor/orchestra/testbench-core/src/Concerns/../../laravel/app/Http/Livewire/Foo.php
to
app/Http/Livewire/Foo.php

and from:
/Users/calebporzio/Documents/Code/sites/livewire/tests/views/livewire/foo.blade.php
to
views/livewire/foo.blade.php

You can reproduce the error by cloning the repository to any other folder on your machine and running the test suite.

Kind regards,
g

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions