Mutagenesis\Mutable::generate PHP Метод

generate() публичный Метод

Based on the current file, generate mutations
public generate ( ) : void
Результат void
    public function generate()
    {
        $this->_mutables = $this->_parseMutables();
        $this->_parseTokensToMutations($this->_mutables);
        return $this;
    }

Usage Example

Пример #1
0
    public function testCreatesLeavesClosuresIntact()
    {
        $file = new Mutable(dirname(__FILE__) . '/_files/Closure.php');
        $file->generate();
        $mutants = $file->getMutants()->all();
        $mutants->rewind();
        $mutant = $mutants->current();
        $this->assertEquals(dirname(__FILE__) . '/_files/Closure.php', $mutant->getFileName());
        $this->assertEquals('Some_Class_With_Closure', $mutant->getClassName());
        $this->assertEquals('setSession', $mutant->getMethodName());
        $this->assertEquals('$session = null', $mutant->getArguments());
        $block = <<<BLOCK

        if (\$session === null) {
            \$dave = function(Closure \$func, array \$d) use (\$session) {
                \$d = \$session;
            };
            return true;
        }

        return false;
    
BLOCK;
        $this->assertEquals($block, $this->_reconstructFromTokens($mutant->getTokens()));
    }