summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--php-Monolog-tests-sentry-gte-0-16-0.patch61
-rw-r--r--php-Monolog.spec26
2 files changed, 79 insertions, 8 deletions
diff --git a/php-Monolog-tests-sentry-gte-0-16-0.patch b/php-Monolog-tests-sentry-gte-0-16-0.patch
new file mode 100644
index 0000000..d687ff2
--- /dev/null
+++ b/php-Monolog-tests-sentry-gte-0-16-0.patch
@@ -0,0 +1,61 @@
+diff --git a/tests/Monolog/Handler/MockRavenClient-gte-0-16-0.php b/tests/Monolog/Handler/MockRavenClient-gte-0-16-0.php
+new file mode 100644
+index 0000000..07434e4
+--- /dev/null
++++ b/tests/Monolog/Handler/MockRavenClient-gte-0-16-0.php
+@@ -0,0 +1,27 @@
++<?php declare(strict_types=1);
++
++/*
++ * This file is part of the Monolog package.
++ *
++ * (c) Jordi Boggiano <j.boggiano@seld.be>
++ *
++ * For the full copyright and license information, please view the LICENSE
++ * file that was distributed with this source code.
++ */
++
++namespace Monolog\Handler;
++
++use Raven_Client;
++
++class MockRavenClient extends Raven_Client
++{
++ public function capture($data, $stack = null, $vars = null)
++ {
++ $data = array_merge($this->get_user_data(), $data);
++ $this->lastData = $data;
++ $this->lastStack = $stack;
++ }
++
++ public $lastData;
++ public $lastStack;
++}
+diff --git a/tests/Monolog/Handler/RavenHandlerTest.php b/tests/Monolog/Handler/RavenHandlerTest.php
+index a7c4845..6ed5790 100644
+--- a/tests/Monolog/Handler/RavenHandlerTest.php
++++ b/tests/Monolog/Handler/RavenHandlerTest.php
+@@ -14,16 +14,21 @@ namespace Monolog\Handler;
+ use Monolog\TestCase;
+ use Monolog\Logger;
+ use Monolog\Formatter\LineFormatter;
++use Raven_Client;
+
+ class RavenHandlerTest extends TestCase
+ {
+ public function setUp()
+ {
+ if (!class_exists('Raven_Client')) {
+- $this->markTestSkipped('raven/raven not installed');
++ $this->markTestSkipped('sentry/sentry not installed');
+ }
+
+- require_once __DIR__ . '/MockRavenClient.php';
++ if (version_compare(Raven_Client::VERSION, '0.16.0', '>=')) {
++ require_once __DIR__ . '/MockRavenClient-gte-0-16-0.php';
++ } else {
++ require_once __DIR__ . '/MockRavenClient.php';
++ }
+ }
+
+ /**
diff --git a/php-Monolog.spec b/php-Monolog.spec
index 4c89097..82ccf9e 100644
--- a/php-Monolog.spec
+++ b/php-Monolog.spec
@@ -22,7 +22,7 @@
%global php_min_ver 5.3.0
# "psr/log": "~1.0"
# NOTE: Min version not 1.0 because autoloader required
-%global psrlog_min_ver 1.0.0-8
+%global psrlog_min_ver 1.0.1
%global psrlog_max_ver 2.0
# "raven/raven": "^0.13"
%global raven_min_ver 0.13
@@ -42,7 +42,7 @@
Name: php-Monolog
Version: %{github_version}
-Release: 1%{?dist}
+Release: 2%{?dist}
Summary: Sends your logs to files, sockets, inboxes, databases and various web services
Group: Development/Libraries
@@ -50,6 +50,12 @@ License: MIT
URL: https://github.com/%{github_owner}/%{github_name}
Source0: %{url}/archive/%{github_commit}/%{name}-%{github_version}-%{github_commit}.tar.gz
+# Fix tests for sentry/sentry >= 0.16.0 (and < 1.0)
+#
+# Patch adapted for Monolog version 1.21.0 from
+# https://github.com/Seldaek/monolog/pull/880
+Patch0: %{name}-tests-sentry-gte-0-16-0.patch
+
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
# Tests
@@ -57,9 +63,7 @@ BuildArch: noarch
## composer.json
BuildRequires: php(language) >= %{php_min_ver}
BuildRequires: php-composer(phpunit/phpunit)
-#BuildRequires: php-composer(psr/log) >= %%{psrlog_min_ver}
-BuildRequires: php-PsrLog >= %{psrlog_min_ver}
-BuildRequires: php-composer(psr/log) < %{psrlog_max_ver}
+BuildRequires: php-composer(psr/log) >= %{psrlog_min_ver}
## optional
BuildRequires: php-composer(swiftmailer/swiftmailer) >= %{swift_min_ver}
BuildRequires: php-composer(raven/raven) >= %{raven_min_ver}
@@ -83,8 +87,7 @@ BuildRequires: php-composer(symfony/class-loader)
# composer.json
Requires: php(language) >= %{php_min_ver}
-#Requires: php-composer(psr/log) >= %%{psrlog_min_ver}
-Requires: php-PsrLog >= %{psrlog_min_ver}
+Requires: php-composer(psr/log) >= %{psrlog_min_ver}
Requires: php-composer(psr/log) < %{psrlog_max_ver}
# phpcompatinfo (computed from version 1.21.0)
Requires: php-curl
@@ -148,6 +151,9 @@ at a later time.
%prep
%setup -qn %{github_name}-%{github_commit}
+: Fix tests for sentry/sentry >= 0.16.0
+%patch0 -p1
+
: Create autoloader
cat <<'AUTOLOAD' | tee src/Monolog/autoload.php
<?php
@@ -229,7 +235,7 @@ if which php56; then
run=1
fi
if [ $run -eq 0 ]; then
- %{_bindir}/phpunit --verbose --bootstrap bootstrap.php || ret =1
+%{_bindir}/phpunit --verbose --bootstrap bootstrap.php
fi
exit $ret;
@@ -253,6 +259,10 @@ rm -rf %{buildroot}
%changelog
+* Sun Nov 06 2016 Shawn Iwinski <shawn.iwinski@gmail.com> - 1.21.0-2
+- Fix test suite for php-sentry >= 0.16.0
+- Modified php-psr-log dependency (min version 1.0.0-8 => 1.0.1)
+
* Mon Aug 08 2016 Shawn Iwinski <shawn.iwinski@gmail.com> - 1.21.0-1
- Updated to 1.21.0 (RHBZ #1362318)