22
33use Monolog \Handler \StreamHandler ;
44use Monolog \Logger ;
5+ use PHPUnit \Framework \TestCase ;
56use Superbalist \Monolog \Formatter \GoogleCloudJsonFormatter ;
67
7- class GoogleCloudLoggerTest extends PHPUnit_Framework_TestCase
8+ class GoogleCloudLoggerTest extends TestCase
89{
910 /**
1011 * @var Logger
@@ -15,15 +16,15 @@ class GoogleCloudLoggerTest extends PHPUnit_Framework_TestCase
1516 /**
1617 * Setup before test runs
1718 */
18- public static function setUpBeforeClass ()
19+ public static function setUpBeforeClass (): void
1920 {
2021 touch (static ::$ logfileOutput );
2122 }
2223
2324 /**
2425 * Test setup
2526 */
26- public function setUp ()
27+ public function setUp (): void
2728 {
2829 $ handler = new StreamHandler (static ::$ logfileOutput , Logger::DEBUG );
2930 $ handler ->setFormatter (new GoogleCloudJsonFormatter ());
@@ -34,7 +35,7 @@ public function setUp()
3435 /**
3536 * Cleanup
3637 */
37- public function tearDown ()
38+ public function tearDown (): void
3839 {
3940 file_put_contents (static ::$ logfileOutput , '' );
4041 unset($ this ->log );
@@ -43,7 +44,7 @@ public function tearDown()
4344 /**
4445 * Cleanup after all tests ran
4546 */
46- public static function tearDownAfterClass ()
47+ public static function tearDownAfterClass (): void
4748 {
4849 unlink (static ::$ logfileOutput );
4950 }
@@ -55,7 +56,7 @@ public function it_should_log_a_debug_in_the_expected_format()
5556 {
5657 $ dt = $ this ->getDateTimeforTest ();
5758
58- $ this ->log ->addDebug ('Test Debug Occurred ' );
59+ $ this ->log ->debug ('Test Debug Occurred ' );
5960
6061 $ expected = '{"message":"Test Debug Occurred","severity":"DEBUG","timestamp":{"seconds": '
6162 . $ dt ->getTimestamp () . ',"nanos":0},"channel":"test-channel"} ' . "\n" ;
@@ -70,7 +71,7 @@ public function it_should_log_an_info_in_the_expected_format()
7071 {
7172 $ dt = $ this ->getDateTimeforTest ();
7273
73- $ this ->log ->addInfo ('Test Info Occurred ' );
74+ $ this ->log ->info ('Test Info Occurred ' );
7475
7576 $ expected = '{"message":"Test Info Occurred","severity":"INFO","timestamp":{"seconds": '
7677 . $ dt ->getTimestamp () . ',"nanos":0},"channel":"test-channel"} ' . "\n" ;
@@ -85,7 +86,7 @@ public function it_should_log_a_notice_in_the_expected_format()
8586 {
8687 $ dt = $ this ->getDateTimeforTest ();
8788
88- $ this ->log ->addNotice ('Test Notice Occurred ' );
89+ $ this ->log ->notice ('Test Notice Occurred ' );
8990
9091 $ expected = '{"message":"Test Notice Occurred","severity":"NOTICE","timestamp":{"seconds": '
9192 . $ dt ->getTimestamp () . ',"nanos":0},"channel":"test-channel"} ' . "\n" ;
@@ -100,7 +101,7 @@ public function it_should_log_a_warning_in_the_expected_format()
100101 {
101102 $ dt = $ this ->getDateTimeforTest ();
102103
103- $ this ->log ->addWarning ('Test Warning Occurred ' );
104+ $ this ->log ->warning ('Test Warning Occurred ' );
104105
105106 $ expected = '{"message":"Test Warning Occurred","severity":"WARNING","timestamp":{"seconds": '
106107 . $ dt ->getTimestamp () . ',"nanos":0},"channel":"test-channel"} ' . "\n" ;
@@ -115,7 +116,7 @@ public function it_should_log_an_error_in_the_expected_format()
115116 {
116117 $ dt = $ this ->getDateTimeforTest ();
117118
118- $ this ->log ->addError ('Test Error Occurred ' );
119+ $ this ->log ->error ('Test Error Occurred ' );
119120
120121 $ expected = '{"message":"Test Error Occurred","severity":"ERROR","timestamp":{"seconds": ' . $ dt ->getTimestamp ()
121122 . ',"nanos":0},"channel":"test-channel"} ' . "\n" ;
@@ -130,7 +131,7 @@ public function it_should_log_a_critical_in_the_expected_format()
130131 {
131132 $ dt = $ this ->getDateTimeforTest ();
132133
133- $ this ->log ->addCritical ('Test Critical Occurred ' );
134+ $ this ->log ->critical ('Test Critical Occurred ' );
134135
135136 $ expected = '{"message":"Test Critical Occurred","severity":"CRITICAL","timestamp":{"seconds": '
136137 . $ dt ->getTimestamp () . ',"nanos":0},"channel":"test-channel"} ' . "\n" ;
@@ -145,7 +146,7 @@ public function it_should_log_an_alert_in_the_expected_format()
145146 {
146147 $ dt = $ this ->getDateTimeforTest ();
147148
148- $ this ->log ->addAlert ('Test Alert Occurred ' );
149+ $ this ->log ->alert ('Test Alert Occurred ' );
149150
150151 $ expected = '{"message":"Test Alert Occurred","severity":"ALERT","timestamp":{"seconds": '
151152 . $ dt ->getTimestamp () . ',"nanos":0},"channel":"test-channel"} ' . "\n" ;
@@ -160,7 +161,7 @@ public function it_should_log_an_emergency_in_the_expected_format()
160161 {
161162 $ dt = $ this ->getDateTimeforTest ();
162163
163- $ this ->log ->addEmergency ('Test Emergency Occurred ' );
164+ $ this ->log ->emergency ('Test Emergency Occurred ' );
164165
165166 $ expected = '{"message":"Test Emergency Occurred","severity":"EMERGENCY","timestamp":{"seconds": '
166167 . $ dt ->getTimestamp () . ',"nanos":0},"channel":"test-channel"} ' . "\n" ;
0 commit comments