*/
public function __destruct() {
if ( !$this->everExecuted ) {
+ $context = [ 'command' => $this->command ];
$message = __CLASS__ . " was instantiated, but execute() was never called.";
if ( $this->method ) {
- $message .= " Calling method: {$this->method}.";
+ $message .= ' Calling method: {method}.';
+ $context['method'] = $this->method;
}
- $message .= " Command: {$this->command}";
- trigger_error( $message, E_USER_NOTICE );
+ $message .= ' Command: {command}';
+ $this->logger->warning( $message, $context );
}
}
* @group Shell
*/
class CommandTest extends PHPUnit_Framework_TestCase {
- /**
- * @expectedException PHPUnit_Framework_Error_Notice
- */
- public function testDestruct() {
- if ( defined( 'HHVM_VERSION' ) ) {
- $this->markTestSkipped( 'destructors are unreliable in HHVM' );
- }
- $command = new Command();
- $command->params( 'true' );
- }
-
private function requirePosix() {
if ( wfIsWindows() ) {
$this->markTestSkipped( 'This test requires a POSIX environment.' );