Skip to content
This repository has been archived by the owner on Jan 10, 2022. It is now read-only.

Commit

Permalink
Added test for succesful calling error handler
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiang committed Nov 13, 2014
1 parent 6adce7d commit 5c4708c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Util/ErrorHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,12 @@ public function execute($file, $line)
});

try {
return call_user_func_array($this->method, $this->arguments);
$value = call_user_func_array($this->method, $this->arguments);
restore_error_handler();
return $value;
} catch (ErrorException $exception) {
restore_error_handler();
throw $exception;
}

restore_error_handler();
}
}
10 changes: 10 additions & 0 deletions tests/src/Util/ErrorHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,16 @@ public function testExecute()
}
}

/**
* @covers ::__construct
* @covers ::execute
*/
public function testExecuteSuccess()
{
$object = new ErrorHandler('trim', ' test');
$this->assertSame('test', $object->execute('0', 1));
}

/**
* @covers ::__construct
* @expectedException \Fabiang\Xmpp\Exception\InvalidArgumentException
Expand Down

0 comments on commit 5c4708c

Please sign in to comment.