runkit icon indicating copy to clipboard operation
runkit copied to clipboard

Rename method to and fro breaks the script

Open elmar-hinz opened this issue 9 years ago • 0 comments

I wrote a unit test to examine the options of runkit. When renaming a method to and fro the test simply breaks when trying to call the method again.

protected function demo($count = 0)
{
    $count += 1;
    return $count;
}

/**
 * @test
 */
public function methodRename()
{
    $this->assertTrue(method_exists($this, 'demo'));
    $this->assertFalse(method_exists($this, 'demo1'));

    $this->assertEquals(1, $this->demo());
    runkit_method_rename(get_class($this), 'demo', 'demo1');
    $this->assertEquals(1, $this->demo1());
    $this->assertFalse(method_exists($this, 'demo'));
    $this->assertTrue(method_exists($this, 'demo1'));

    runkit_method_rename(get_class($this), 'demo1', 'demo');
    $this->assertTrue(method_exists($this, 'demo'));
    $this->assertFalse(method_exists($this, 'demo1'));
    // Here the execution of the unit test breaks:
    $this->assertEquals(1, $this->demo());
}

runkit

runkit support => enabled version => 1.0.4-dev Custom Superglobal support => enabled Sandbox Support => disable or unavailable Runtime Manipulation => enabled

elmar-hinz avatar May 12 '16 08:05 elmar-hinz