Question

I get the impression the codeception documentation is outdated.

I have Cept files working with a usersteps definition file that I use for things like login calls.

Due to complexity, I'd love to use Cest classes instead, but I can't get them to recognize my Usersteps. Here's an example:

<?php

/*
 * @guy TestGuy\UserSteps
 */
class ViewPagesCest {

public function testViewCharacter(TestGuy $I) {
    $I->loginToCharacter('admin', 'admin', 'Alice Kepler');

    $target = $I->grabFromRepository('BM2SiteBundle:Character', 'id', array('name' => 'Carol Stanis'));
    $I->amOnPage('/en/character/view/'.$target->getId());
    $I->see($target->getName());
}

}

I get, of course:

[RuntimeException] Call to undefined method TestGuy::loginToCharacter

because loginToCharacter is defined in a usersteps file. The same stuff as a Cept file works just fine. What am I missing?

Was it helpful?

Solution

You should use docblock (T_DOC_BLOCK) to place @guy annotation, but you use comment (T_COMMENT).

Just add second star at beginning of your comment:

/**
 * @guy TestGuy\UserSteps
 */
class ViewPagesCest {
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top