mirror of
https://gitlab.com/openlp/website.git
synced 2024-08-31 02:53:38 +00:00
29 lines
829 B
PHP
29 lines
829 B
PHP
|
<?php
|
||
|
|
||
|
// Test in a slightly different namespace than usual. See comment on
|
||
|
// `error_log` below.
|
||
|
namespace Stripe\Util;
|
||
|
|
||
|
class UtilLoggerTest extends \Stripe\TestCase
|
||
|
{
|
||
|
public function testDefaultLogger()
|
||
|
{
|
||
|
$logger = new DefaultLogger();
|
||
|
$logger->error("message");
|
||
|
|
||
|
global $lastMessage;
|
||
|
$this->assertSame($lastMessage, "message");
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// This is a little terrible, but unfortunately there's no clean way to stub a
|
||
|
// call to `error_log`. Here we overwrite it so that we can get the last arguments
|
||
|
// that went to it. This is obviously bad, but luckily it's constrained to
|
||
|
// being just in \Stripe\Util (i.e. won't interfere with PHPUnit for example)
|
||
|
// and _just_ present when tests are running.
|
||
|
function error_log($message)
|
||
|
{
|
||
|
global $lastMessage;
|
||
|
$lastMessage = $message;
|
||
|
}
|