Codeception\Specify::specify PHP Method

specify() public method

public specify ( $specification, Closure $callable = null, $params = [] )
$callable Closure
    function specify($specification, \Closure $callable = null, $params = [])
    {
        if (!$callable) {
            return;
        }
        $this->specifyInit();
        $test = $callable->bindTo($this);
        $oldName = $this->getName();
        $newName = $oldName . ' | ' . $specification;
        $this->setName($newName);
        $properties = $this->getSpecifyObjectProperties();
        // prepare for execution
        $throws = $this->getSpecifyExpectedException($params);
        $examples = $this->getSpecifyExamples($params);
        $showExamplesIndex = $examples !== [[]];
        foreach ($examples as $idx => $example) {
            if ($showExamplesIndex) {
                $this->setName($newName . ' | examples index ' . $idx);
            }
            // copy current object properties
            $this->specifyCloneProperties($properties);
            if (!empty($this->beforeSpecify) && is_array($this->beforeSpecify)) {
                foreach ($this->beforeSpecify as $closure) {
                    if ($closure instanceof \Closure) {
                        $closure->__invoke();
                    }
                }
            }
            $this->specifyExecute($test, $throws, $example);
            // restore object properties
            $this->specifyRestoreProperties($properties);
            if (!empty($this->afterSpecify) && is_array($this->afterSpecify)) {
                foreach ($this->afterSpecify as $closure) {
                    if ($closure instanceof \Closure) {
                        $closure->__invoke();
                    }
                }
            }
        }
        // restore test name
        $this->setName($oldName);
    }