Mutagenesis\Mutation\MutationAbstract::mutate PHP Method

mutate() public method

Perform a mutation against the given original source code tokens for a mutable element
public mutate ( array $tokens, integer $index )
$tokens array
$index integer
    public function mutate($tokens, $index)
    {
        $this->_tokensOriginal = $tokens;
        $this->_tokensMutated = $this->getMutation($this->_tokensOriginal, $index);
        return $this->_reconstructFromTokens($this->_tokensMutated);
    }

Usage Example

Ejemplo n.º 1
0
 /**
  * @dataProvider getDiffTestProvider
  */
 public function testGetDiff($tokensOriginal, $tokensMutated, $expected)
 {
     $this->mutation->shouldReceive('getMutation')->andReturn($tokensMutated);
     $this->mutation->mutate($tokensOriginal);
     $actual = $this->mutation->getDiff();
     $this->assertEquals($expected, $actual);
 }