Example #1
0
 public function testShouldRevertToOriginalMethodBodyWhenRequested()
 {
     $mutation = array('file' => $this->root . '/runkit/Math1.php', 'class' => 'RunkitTest_Math1', 'method' => 'add', 'args' => '$op1,$op2', 'tokens' => array(array(335, 'return', 7), array(309, '$op1', 7), '+', array(309, '$op2', 7), ';'), 'index' => 2, 'mutation' => new \Mutagenesis\Mutation\OperatorAddition($this->root . '/runkit/Math1.php'));
     $runkit = new \Mutagenesis\Utility\Runkit();
     $runkit->applyMutation($mutation);
     $math = new RunkitTest_Math1();
     $runkit->reverseMutation($mutation);
     $this->assertEquals(2, $math->add(1, 1));
 }
Example #2
0
 public function testShouldRevertToOriginalMethodBodyWhenRequested()
 {
     $mutationInstance = new OperatorAddition(2);
     $testeeInstance = new Testee();
     $testeeInstance->setFileName($this->root . '/runkit/Math1.php')->setClassName('RunkitTest_Math1')->setMethodName('add')->setArguments('$op1,$op2')->setTokens(array(array(335, 'return', 7), array(309, '$op1', 7), '+', array(309, '$op2', 7), ';'));
     $mutant = new Mutant($testeeInstance, $mutationInstance);
     $runkit = new Runkit();
     $runkit->applyMutation($mutant);
     $math = new \RunkitTest_Math1();
     $runkit->reverseMutation($mutant);
     $this->assertEquals(2, $math->add(1, 1));
 }