From fc4a21c5f4d77083dc56fca7459184719673ba50 Mon Sep 17 00:00:00 2001 From: Jon Parise Date: Sun, 7 Jan 2024 08:42:35 -0800 Subject: [PATCH] Add the PHP 8.x releases to the testing matrix --- .github/workflows/ci.yml | 2 +- tests/extract-zend2.2.phpt | 5 ++- tests/extract-zend4.3.phpt | 67 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 72 insertions(+), 2 deletions(-) create mode 100644 tests/extract-zend4.3.phpt diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5c17cfe..4d93247 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - php-version: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4'] + php-version: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3'] steps: - uses: actions/checkout@v2 diff --git a/tests/extract-zend2.2.phpt b/tests/extract-zend2.2.phpt index a498f7c..8b46d1e 100644 --- a/tests/extract-zend2.2.phpt +++ b/tests/extract-zend2.2.phpt @@ -1,7 +1,10 @@ --TEST-- Log: _extractMessage() [Zend Engine 2.2] --SKIPIF-- - +=")) die('skip'); +?> --INI-- date.timezone=UTC --FILE-- diff --git a/tests/extract-zend4.3.phpt b/tests/extract-zend4.3.phpt new file mode 100644 index 0000000..33fee5b --- /dev/null +++ b/tests/extract-zend4.3.phpt @@ -0,0 +1,67 @@ +--TEST-- +Log: _extractMessage() [Zend Engine 2.2] +--SKIPIF-- + +--INI-- +date.timezone=UTC +--FILE-- + '%2$s [%3$s] %4$s'); +$logger = Log::singleton('console', '', 'ident', $conf); + +/* Logging a regular string. */ +$logger->log('String'); + +/* Logging a bare object. */ +class BareObject {} +$logger->log(new BareObject()); + +/* Logging an object with a getMessage() method. */ +class GetMessageObject { function getMessage() { return "getMessage"; } } +$logger->log(new GetMessageObject()); + +/* Logging an object with a toString() method. */ +class ToStringObject { function toString() { return "toString"; } } +$logger->log(new ToStringObject()); + +/* Logging an object with a __toString() method using casting. */ +class CastableObject { function __toString() { return "__toString"; } } +$logger->log(new CastableObject()); + +/* Logging a PEAR_Error object. */ +require_once 'PEAR.php'; +$logger->log(new PEAR_Error('PEAR_Error object', 100)); + +/* Logging an array. */ +$logger->log(array(1, 2, 'three' => 3)); + +/* Logging an array with scalar 'message' keys. */ +$logger->log(array('message' => 'Message Key')); +$logger->log(array('message' => 50)); + +/* Logging an array with a non-scalar 'message' key. */ +$logger->log(array('message' => array(1, 2, 3))); + +--EXPECT-- +ident [info] String +ident [info] \BareObject::__set_state(array( +)) +ident [info] getMessage +ident [info] toString +ident [info] __toString +ident [info] PEAR_Error object +ident [info] array ( + 0 => 1, + 1 => 2, + 'three' => 3, +) +ident [info] Message Key +ident [info] 50 +ident [info] array ( + 0 => 1, + 1 => 2, + 2 => 3, +)