Hal\MutaTesting\Mutater\MutaterSimpleAbstract::mutateOne PHP Method

mutateOne() protected method

protected mutateOne ( Hal\MutaTesting\Mutation\MutationInterface $original, $index, $expected, Hal\Component\Token\Token $newToken )
$original Hal\MutaTesting\Mutation\MutationInterface
$newToken Hal\Component\Token\Token
    protected function mutateOne(MutationInterface $original, $index, $expected, Token $newToken)
    {
        $token = $original->getTokens()->offsetGet($index);
        if ($token->getType() !== $expected) {
            throw new \UnexpectedValueException(sprintf('invalid token "%s" given in %s', token_name($token->getType()), get_class($this)));
        }
        $new = new \Hal\MutaTesting\Mutation\Mutation();
        $new->setTokens($original->getTokens()->replace($index, $newToken))->setUnit($original->getUnit())->setSourceFile($original->getSourceFile())->setTestFile($original->getTestFile())->setMutedTokensIndexes(array_merge($original->getMutedTokensIndexes(), array($index)));
        return $new;
    }
MutaterSimpleAbstract