Search code examples
phplaraveltestingcodeceptionbehat

Does Codeception BDD have a @Transform function like Behat does?


In Behat you can do a transformation like so:

<?php

/**
 * @Transform /^"([^"]+)" shipping method$/
 * @Transform /^shipping method "([^"]+)"$/
 * @Transform :shippingMethod
 */
public function getShippingMethodByName($shippingMethodName)
{
    $shippingMethod = $this->shippingMethodRepository->findOneByName($shippingMethodName);

    Assert::notNull(
        $shippingMethod,
        sprintf('Shipping method with name "%s" does not exist', $shippingMethodName)
    );

    return $shippingMethod;
}

/**
 * @Given /^(shipping method "[^"]+") belongs to ("[^"]+" tax category)$/
 */
public function shippingMethodBelongsToTaxCategory(
    ShippingMethodInterface $shippingMethod,
    TaxCategoryInterface $taxCategory
) {
    // some logic here
}

Basically, adding a colon before a variable and using @Transform keyword.

Is there a way to do that in Codeception?


Solution

  • codeception, despite using behat vendor libraries, does not implement the @Transform feature.