문제

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?

도움이 되었습니까?

해결책

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 {
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top