Unable to determine the path info of the current request


(Dataskills) #1

I am just trying to get started with formal php testing and I am not getting anywhere after spending two days on it. I am just trying to run a simple test to check the about page and I get the following error: [yii\base\InvalidConfigException] Unable to determine the path info of the current request.

DOES ANYONE HAVE ANY IDEA WHAT IS CAUSING THIS?

Here is the entire output:


$  vendor/bin/codecept run functional AboutCest:checkAbout -c frontend

Codeception PHP Testing Framework v2.1.11

Powered by PHPUnit 5.3.5 by Sebastian Bergmann and contributors.


Frontend\tests.functional Tests (1) ------------------------------------------------------------------------

Check about (functional\AboutCest::checkAbout)                                                        Error

------------------------------------------------------------------------------------------------------------




Time: 121 ms, Memory: 10.00MB


There was 1 error:


---------

1) Failed to check about in frontend\tests\functional\AboutCest::checkAbout (tests/functional/AboutCest.php)


                                                                                               

  [yii\base\InvalidConfigException] Unable to determine the path info of the current request.  

                                                                                               


Scenario Steps:


 1. $I->amOnPage(["site/about"])


#1  /Applications/MAMP/htdocs/cygnus/vendor/yiisoft/yii2/web/Request.php:724

#2  /Applications/MAMP/htdocs/cygnus/vendor/yiisoft/yii2/web/UrlRule.php:306

#3  /Applications/MAMP/htdocs/cygnus/vendor/yiisoft/yii2/web/UrlManager.php:269

#4  /Applications/MAMP/htdocs/cygnus/vendor/yiisoft/yii2/web/Request.php:183

#5  /Applications/MAMP/htdocs/cygnus/vendor/yiisoft/yii2/web/Application.php:82

#6  /Applications/MAMP/htdocs/cygnus/vendor/symfony/browser-kit/Client.php:315

#7  Codeception\Module\Yii2->amOnPage

#8  /Applications/MAMP/htdocs/cygnus/frontend/tests/_support/_generated/FunctionalTesterActions.php:528

#9  /Applications/MAMP/htdocs/cygnus/frontend/tests/functional/AboutCest.php:10

#10 frontend\tests\functional\AboutCest->checkAbout


FAILURES!

Tests: 1, Assertions: 0, Errors: 1.

=============================================

I would appreciate any help, this is my third try to get going with testing with codeception, I have spent a good solid week on this in all and cannot get ONE SINGLE TEST WORKING. NOT ONE!


(Ft07) #2

At least the tests works in a fresh install on OpenSuse (Leap 42.2)

I did the following (root shell)

composer create-project yiisoft/yii2-app-advanced AppYii2011-advanced 2.0.11

cd AppYii2011-advanced

(init to dev environment)

./init

(created db yii2advanced_test)

./yii_test migrate

(all tests)

vendor/bin/codecept run

(partial tests)

vendor/bin/codecept run – -c common

vendor/bin/codecept run – -c frontend

(single test)

vendor/bin/codecept run functional AboutCest:checkAbout -c frontend

Everything OK


(Dataskills) #3

Yes, it works with a fresh install of course, I was wondering if anyone has insight as to the particular error I am getting. I am trying to add code coverage to a code base that originated as Yii 2.0. I have spent time trying to update the test files, etc to codeception 2.1.* etc. I am stuck on this error. Not only can I not figure it out but I can’t figure out how to debug it. Do you know of some way to debug tests?


(Dataskills) #4

I found out that this error only happens when I use the UrlManager application component.

If I comment out the UrlManager the test works, but the test fails because my routing has been commented out.

I found something out looking in the code referred to in the stack trace (#1 /Applications/MAMP/htdocs/cygnus/vendor/yiisoft/yii2/web/Request.php:724):

When I try to use the UrlManager, the $scriptUrl variable has a value of “vendor/bin/codecept”. It should have the value “/index-test.php” and I can’t figure out why it doesn’t.


(Dataskills) #5

Forget it, I will try to hire someone. This is impossible.


(Eghlima R) #6

Hello

I am using the Yii1 and I have the same error.

It has nothing with Yii, It is Nginx or Apache responsibility to provide pathinfo to php/yii.

My Error is:

CHttpRequest is unable to determine the path info of the request.

I am sure about miss configuration of my nginx and I am going to fix it.

You have nginx or Apache?

I will post my result asap.


(Dataskills) #7

My problem was with Yii2, I have since gotten past the error. I am not exactly sure what was causing the but generally the problem was the testing lib packages, testing lib version(s), and my project structure was out of sync. I had to update all packages and update my project structure. Then everything worked.