0

I'm trying to run codeception tests written by another dev at my organization. I'm on php 5.6 and this is a laravel 5 app with codeception 2.1. The specific error that I'm getting is The use statement with non-compound name 'FunctionalTester' has no effect

Every codeception-generated functional test in our directory includes the line use \FunctionalTester;; i can suppress the error just by adding as ft; to the end of the line, but that's not the point.

in some other examples online i see the keyword namespace instead of use here.

as a final example, the command php ./vendor/bin/codecept generate:cest functional foo generates the following file, (which will raise that error)

use \FunctionalTester;

class fooCest
{
  public function _before(FunctionalTester $I)
  {
  }blah blah blah

btw, php is not my main language. Even if this use with no namespace were redundant, i don't see the point of raising on it. OK! Thanks!

4
  • is there a question in that? Commented Jan 8, 2016 at 3:44
  • The error for using use with an object in the global namespace - a non-compound object. The code causing it is generated automatically by codeception. It is only happening on my system as far as I can tell. Commented Jan 8, 2016 at 3:47
  • I am trying to figure out what your question is because all there is here is statements. :) Commented Jan 8, 2016 at 3:48
  • I'm wondering why I am getting an error from code generated by the codeception framework when it doesn't seem to be an issue for others. I guess my question is about running tests without raising an exception on line 2. Commented Jan 8, 2016 at 4:22

2 Answers 2

1

Upgrade Codeception to 2.1.5, this issue is fixed already: https://github.com/Codeception/Codeception/commit/892f85388c8dd2c57e120f9a3e225074a9ae175b

Sign up to request clarification or add additional context in comments.

Comments

1

Remove

use \FunctionalTester;

The reason you're getting that warning is that while being in global namespace you're trying to import a class from a global namespace, which is not needed and hence has no effect.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.