HMLB\VW\SecretSoftware::force PHP Method

force() public method

Failing test cases are not a problem anymore.
public force ( PHPUnit_Framework_TestCase $test )
$test PHPUnit_Framework_TestCase
    public function force(PHPUnit_Framework_TestCase $test)
    {
        if (!$test->hasFailed()) {
            return;
        }
        $testReflection = new ReflectionClass('PHPUnit_Framework_TestCase');
        $resultReflection = new ReflectionClass('PHPUnit_Framework_TestResult');
        $result = $this->getPropertyValue($testReflection, 'result', $test);
        $this->forcePropertyValue($resultReflection, 'errors', array(), $result)->forcePropertyValue($resultReflection, 'failures', array(), $result)->forcePropertyValue($resultReflection, 'risky', array(), $result)->forcePropertyValue($testReflection, 'status', PHPUnit_Runner_BaseTestRunner::STATUS_PASSED, $test)->forcePropertyValue($testReflection, 'statusMessage', '', $test);
    }

Usage Example

Beispiel #1
0
 /**
  * {@inheritdoc}
  */
 public function endTest(PHPUnit_Framework_Test $test, $time)
 {
     if (!$test instanceof PHPUnit_Framework_TestCase) {
         return;
     }
     if ($this->secretSoftware->underScrutiny()) {
         $this->secretSoftware->force($test);
     }
 }