b0y-101 Mini Shell


Current Path : E:/www/b-group.old/spfin - Copy/testpayment/src/xdebug/tests/coverage/
File Upload :
Current File : E:/www/b-group.old/spfin - Copy/testpayment/src/xdebug/tests/coverage/bug01180.phpt

--TEST--
Test for bug #1180: Code coverage crashes with non-standard start/stops
--INI--
xdebug.mode=coverage
xdebug.trace_options=0
xdebug.collect_return=0
xdebug.collect_assignments=0
xdebug.auto_profile=0
xdebug.dump_globals=0
xdebug.trace_format=0
--FILE--
<?php
class TestHelper
{
    protected static $coverageStopped = false;

    public static function stopCodeCoverage()
    {
        if (self::$coverageStopped === false) {
            self::$coverageStopped = xdebug_stop_code_coverage(false);
        }
    }

    public static function resumeCodeCoverage()
    {
        xdebug_start_code_coverage(XDEBUG_CC_UNUSED | XDEBUG_CC_DEAD_CODE);

        self::$coverageStopped = false;
    }

    public static function stopAndResumeCoverage()
    {
        self::stopCodeCoverage();
        self::resumeCodeCoverage();
    }
}

function testWorksWithoutIntermediaryMethod()
{
	\TestHelper::stopCodeCoverage();
	\TestHelper::stopCodeCoverage();
	\TestHelper::resumeCodeCoverage();
	\TestHelper::resumeCodeCoverage();
}

function testIntermediaryMethodExplodesIfWeDoChangeStaticProperty()
{
	\TestHelper::stopCodeCoverage();
	\TestHelper::stopAndResumeCoverage();
}

testWorksWithoutIntermediaryMethod();
testIntermediaryMethodExplodesIfWeDoChangeStaticProperty();

echo "no crash\n";
?>
--EXPECT--
no crash

Copyright © 2019 by b0y-101