Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Codeception RuntimeException Call to undefined method FunctionalTester::amOnPage

I have set up a functional test following the tutorials at:

  • http://codeception.com/docs/04-FunctionalTests
  • http://codeception.com/docs/modules/Symfony
  • http://codeception.com/09-04-2015/using-codeception-for-symfony-projects.html

The main difference is that I've set up Codeception the traditional way because I don't want to mix test code with project code.

This is my functional test (I know it's not actually testing anything):

<?php

class MyFirstCest {
  public function _before(FunctionalTester $I) {
  }

  public function _after(FunctionalTester $I) {
  }

  // tests
  public function tryToTest(FunctionalTester $I) {
    $I->amOnPage('/app/login/');
  }
}

When I run the functional test I get:

[RuntimeException] Call to undefined method FunctionalTester::amOnPage

When I rebuild Codeception, I get:

Building Actor classes for suites: acceptance, functional, unit -> AcceptanceTesterActions.php generated successfully. 0 methods added \AcceptanceTester includes modules: PhpBrowser, \Helper\Acceptance -> FunctionalTesterActions.php generated successfully. 0 methods added \FunctionalTester includes modules: -> UnitTesterActions.php generated successfully. 0 methods added \UnitTester includes modules: Asserts, \Helper\Unit

The critical part seems to be \FunctionalTester includes modules: which is empty.

My functional.suite.yml file looks like this:

actor: FunctionalTester
modules:
    - Symfony:
        app_path: 'app'
        environment: 'local_test'
class_name: FunctionalTester
modules:
    enabled:
        - Symfony2:
            app_path: 'path/to/app'
            var_path: 'path/to/app'
        - Doctrine2:
            depends: Symfony2
        - \Helper\Functional
        - PhpBrowser:
            url: dev.hmr-app
        - \AcmeBundle\Helper\Functional

where the Symfony app lives in path/to/app. I know there's a lot of junk in there, but that's because I've been experimenting, trying to get it to work.

What am I doing wrong?

like image 577
CJ Dennis Avatar asked Jul 01 '26 21:07

CJ Dennis


1 Answers

I think that your problem is that you have

modules:
    - Symfony:
        app_path: 'app'
        environment: 'local_test'

in the config.

That section is completely misplaced and it probably is causing you issues. Please remove it and rename Symfony2 with Symfony in enabled section.

Also make sure that you are using the latest version of Codeception.

like image 79
Naktibalda Avatar answered Jul 03 '26 15:07

Naktibalda



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!