3v4l.org

run code in 300+ PHP versions simultaneously
<?php class HttpNotFoundException extends RestResponseException { public function getHttpStatusCode() { // ... } } abstract class RestResponseException extends IdentifiableException { public abstract function getHttpStatusCode(); } class IdentifiableException extends Exception { // ... } // ----------------------- and here come the tests: class HttpNotFoundExceptionTests extends RestResponseExceptionTests { protected function getSystemUnderTest() { return new HttpNotFoundException(); } // ... tests logic specific to HttpNotFoundException } class RestResponseExceptionTests extends IdentifiableExceptionTests { /** * @return RestResponseException */ protected abstract function getSystemUnderTest(); } class IdentifiableExceptionTests extends PHPUnit_Framework_TestCase { /** * @return IdentifiableException */ protected function getSystemUnderTest() { return new IdentifiableException(); } //... tests IdentifiableException logic }
Output for 5.3.7 - 5.3.28, 5.4.0 - 5.4.30
Fatal error: Class RestResponseExceptionTests contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (RestResponseExceptionTests::getSystemUnderTest) in /in/ZMOs6 on line 38
Process exited with code 255.

preferences:
180.17 ms | 1395 KiB | 60 Q