lara1376's avatar

CodeCeption functional test trailing slash

Hi there,

I've created a functional test which checks for the following:

$I->seeCurrentRouteIs('projects.index');

However when I run this test I get the following:

1) Failed to user can delete project in ProjectsTestCest::userCanDeleteProject (tests/functional/ProjectsTestCest.php)

 Step  I see current route is "projects.index"
 Fail  Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'/'
+''

If I change my test to check for:

$I->seeCurrentUrlEquals('');

This test passes. If possible I'd still like to check for the current route as it keeps my testing more dynamic.

Has anyone had a similar problem and managed to solve?

Update

Have tried setting root the following in tests/functional.suite.yml to no avail:

class_name: FunctionalTester
modules:
    enabled:
        - Helper\Functional
        - Asserts
        - Laravel5:
            environment_file: .env.testing
            root: /
0 likes
4 replies
bashy's avatar

So it's loading it without trailing slash? Have you got trailing slash forced? What is the URI for projects.index?

lara1376's avatar

@bashy projects.index is as follows:

Route::get('/', [
    'as'   => 'projects.index',
    'uses' => 'ProjectController@index'
]);

I'm not sure what you mean by:

Have you got trailing slash forced?

Where would I have forced this?

bashy's avatar

Oh okay, it's your index route. By your title I thought you meant trailing slash in the URI example.com/projects/ :P

I'm not sure on your solution now, sorry.

lara1376's avatar

@bashy Ok - thanks for looking though. Have opened an issue on GitHub as I'm convinced it's a bug.

Please or to participate in this conversation.