summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2018-01-22 11:10:49 +0100
committerRemi Collet <remi@remirepo.net>2018-01-22 11:10:49 +0100
commiteaf2efe5dbe08d49e674a904aed46b05f75a02bd (patch)
tree1e0e70f148c0bd5845b2c70ba2208d3992ef3378
parentd30532646e05be2d361348ba6287e51346e2069f (diff)
Update to 1.0
rename to php-mockery and move to /usr/share/php/Mockery1 raise dependency on PHP 5.6 raise dependency on hamcrest/hamcrest-php 2.0 use phpunit6 on F26+
-rw-r--r--.gitignore8
-rw-r--r--798.patch47
-rw-r--r--composer.json27
-rw-r--r--mockery-tests.patch16
-rw-r--r--php-mockery.spec112
5 files changed, 158 insertions, 52 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..fc9aa8c
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,8 @@
+clog
+package-*.xml
+*.tgz
+*.tar.gz
+*.tar.xz
+*.tar.xz.asc
+*.src.rpm
+*/*rpm
diff --git a/798.patch b/798.patch
new file mode 100644
index 0000000..f0e29fb
--- /dev/null
+++ b/798.patch
@@ -0,0 +1,47 @@
+diff -up tests/Mockery/DemeterChainTest.php.test tests/Mockery/DemeterChainTest.php
+diff -up tests/Mockery/ExpectationTest.php.test tests/Mockery/ExpectationTest.php
+--- tests/Mockery/ExpectationTest.php.test 2017-10-06 18:20:43.000000000 +0200
++++ tests/Mockery/ExpectationTest.php 2018-01-22 10:42:30.193764672 +0100
+@@ -1309,14 +1309,14 @@ class ExpectationTest extends MockeryTes
+
+ public function testObjectConstraintMatchesArgument()
+ {
+- $this->mock->shouldReceive('foo')->with(Mockery::type('object'))->once();
++ $this->mock->shouldReceive('foo')->with(Mockery::type('stdClass'))->once();
+ $this->mock->foo(new stdClass);
+ }
+
+ public function testObjectConstraintNonMatchingCase()
+ {
+ $this->mock->shouldReceive('foo')->times(3);
+- $this->mock->shouldReceive('foo')->with(1, Mockery::type('object`'))->never();
++ $this->mock->shouldReceive('foo')->with(1, Mockery::type('stdClass`'))->never();
+ $this->mock->foo();
+ $this->mock->foo(1);
+ $this->mock->foo(1, 2, 3);
+@@ -1327,7 +1327,7 @@ class ExpectationTest extends MockeryTes
+ */
+ public function testObjectConstraintThrowsExceptionWhenConstraintUnmatched()
+ {
+- $this->mock->shouldReceive('foo')->with(Mockery::type('object'));
++ $this->mock->shouldReceive('foo')->with(Mockery::type('stdClass'));
+ $this->mock->foo('f');
+ Mockery::close();
+ }
+diff -up tests/Mockery/NamedMockTest.php.test tests/Mockery/NamedMockTest.php
+--- tests/Mockery/NamedMockTest.php.test 2017-10-06 18:20:43.000000000 +0200
++++ tests/Mockery/NamedMockTest.php 2018-01-22 10:40:50.894254568 +0100
+@@ -35,11 +35,11 @@ class NamedMockTest extends MockeryTestC
+ /** @test */
+ public function itCreatesPassesFurtherArgumentsJustLikeMock()
+ {
+- $mock = Mockery::namedMock("Mockery\Dave456", "DateTime", array(
++ $mock = Mockery::namedMock("Mockery\Dave456", "DateTimeZone", array(
+ "getDave" => "dave"
+ ));
+
+- $this->assertInstanceOf("DateTime", $mock);
++ $this->assertInstanceOf("DateTimeZone", $mock);
+ $this->assertEquals("dave", $mock->getDave());
+ }
+
diff --git a/composer.json b/composer.json
index d538f0d..5961925 100644
--- a/composer.json
+++ b/composer.json
@@ -1,8 +1,19 @@
{
"name": "mockery/mockery",
"description": "Mockery is a simple yet flexible PHP mock object framework for use in unit testing with PHPUnit, PHPSpec or any other testing framework. Its core goal is to offer a test double framework with a succinct API capable of clearly defining all possible object operations and interactions using a human readable Domain Specific Language (DSL). Designed as a drop in alternative to PHPUnit's phpunit-mock-objects library, Mockery is easy to integrate with PHPUnit and can operate alongside phpunit-mock-objects without the World ending.",
- "keywords": ["library", "testing", "test", "stub", "mock", "mockery", "test double", "tdd", "bdd", "mock objects"],
- "homepage": "http://github.com/padraic/mockery",
+ "keywords": [
+ "bdd",
+ "library",
+ "mock",
+ "mock objects",
+ "mockery",
+ "stub",
+ "tdd",
+ "test",
+ "test double",
+ "testing"
+ ],
+ "homepage": "http://github.com/mockery/mockery",
"license": "BSD-3-Clause",
"authors": [
{
@@ -17,19 +28,21 @@
}
],
"require": {
- "php": ">=5.3.2",
+ "php": ">=5.6.0",
"lib-pcre": ">=7.0",
- "hamcrest/hamcrest-php": "~1.1"
+ "hamcrest/hamcrest-php": "~2.0"
},
"require-dev": {
- "phpunit/phpunit": "~4.0"
+ "phpunit/phpunit": "~5.7|~6.1"
},
"autoload": {
- "psr-0": { "Mockery": "library/" }
+ "psr-0": {
+ "Mockery": "library/"
+ }
},
"extra": {
"branch-alias": {
- "dev-master": "0.9.x-dev"
+ "dev-master": "1.0.x-dev"
}
}
}
diff --git a/mockery-tests.patch b/mockery-tests.patch
new file mode 100644
index 0000000..4955127
--- /dev/null
+++ b/mockery-tests.patch
@@ -0,0 +1,16 @@
+diff -up tests/Bootstrap.php.rpm tests/Bootstrap.php
+--- tests/Bootstrap.php.rpm 2018-01-22 10:30:27.396051495 +0100
++++ tests/Bootstrap.php 2018-01-22 10:36:43.834985419 +0100
+@@ -50,11 +50,7 @@ if (!file_exists($autoloadPath)) {
+
+ require_once $autoloadPath;
+
+-$hamcrestRelativePath = 'hamcrest/hamcrest-php/hamcrest/Hamcrest.php';
+-if (DIRECTORY_SEPARATOR !== '/') {
+- $hamcrestRelativePath = str_replace('/', DIRECTORY_SEPARATOR, $hamcrestRelativePath);
+-}
+-$hamcrestPath = $composerVendorDirectory . DIRECTORY_SEPARATOR . $hamcrestRelativePath;
++$hamcrestPath = '/usr/share/php/Hamcrest2/Hamcrest.php';
+
+ require_once $hamcrestPath;
+
diff --git a/php-mockery.spec b/php-mockery.spec
index 818a9bd..f8159b2 100644
--- a/php-mockery.spec
+++ b/php-mockery.spec
@@ -1,4 +1,4 @@
-# remirepo spec file for php-deepend-Mockery, from
+# remirepo spec file for php-mockery, from
#
# Fedora spec file for php-deepend-Mockery
#
@@ -7,50 +7,62 @@
#
# Please preserve changelog entries
#
-%global gh_commit 6fdb61243844dc924071d3404bb23994ea0b6856
+%global gh_commit 1bac8c362b12f522fdd1f1fa3556284c91affa38
%global gh_short %(c=%{gh_commit}; echo ${c:0:7})
%global gh_owner padraic
%global gh_project mockery
+%global ns_project Mockery
+%global major 1
%global with_tests 0%{!?_without_tests:1}
-Name: php-deepend-Mockery
-Version: 0.9.9
-Release: 4%{?dist}
+Name: php-mockery
+Version: 1.0
+Release: 1%{?dist}
Summary: Mockery is a simple but flexible PHP mock object framework
Group: Development/Libraries
License: BSD
URL: https://github.com/%{gh_owner}/%{gh_project}
-Source0: https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit}/%{gh_project}-%{version}-%{gh_short}.tar.gz
-
-# Autoloader
-Source1: %{gh_project}-autoload.php
+Source0: https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit}/%{name}-%{version}-%{gh_short}.tar.gz
# Use our autoloader
Patch0: %{gh_project}-tests.patch
-# Upstream patch for 7.2
-Patch1: https://github.com/mockery/mockery/commit/b2f20b33942c2c84bc3b3b169098b448b3e66737.patch
-Patch2: https://patch-diff.githubusercontent.com/raw/mockery/mockery/pull/798.patch
+# Patch for 7.2
+# From https://github.com/mockery/mockery/pull/798
+Patch2: 798.patch
BuildArch: noarch
%if %{with_tests}
# From composer.json, "require-dev": {
-# "phpunit/phpunit": "~4.0"
-BuildRequires: php-composer(phpunit/phpunit) >= 4.0
-BuildRequires: php(language) >= 5.3.2
-BuildRequires: php-composer(hamcrest/hamcrest-php) >= 1.1
+# "phpunit/phpunit": "~5.7|~6.1"
+%if 0%{?fedora} >= 26
+%global phpunit %{_bindir}/phpunit6
+BuildRequires: phpunit6
+%else
+%global phpunit %{_bindir}/phpunit
+BuildRequires: php-phpunit-PHPUnit >= 5.7
+%endif
+BuildRequires: php(language) >= 5.6.0
+%if 0%{?fedora} >= 27
+BuildRequires: (php-composer(hamcrest/hamcrest-php) >= 2.0 with php-composer(hamcrest/hamcrest-php) < 3)
+%else
+BuildRequires: php-hamcrest2
+%endif
# Autoloader
-BuildRequires: php-composer(fedora/autoloader)
%endif
+BuildRequires: php-fedora-autoloader-devel
# From composer.json, "require": {
-# "php": ">=5.3.2",
+# "php": ">=5.6.0",
# "lib-pcre": ">=7.0",
-# "hamcrest/hamcrest-php": "~1.1"
-Requires: php(language) >= 5.3.2
-Requires: php-composer(hamcrest/hamcrest-php) >= 1.1
-Requires: php-composer(hamcrest/hamcrest-php) < 2
-# From phpcompatinfo report for version 0.9.7
+# "hamcrest/hamcrest-php": "~2.0"
+Requires: php(language) >= 5.6.0
+%if 0%{?fedora} >= 27
+Requires: (php-composer(hamcrest/hamcrest-php) >= 2.0 with php-composer(hamcrest/hamcrest-php) < 3)
+%else
+Requires: php-hamcrest2
+%endif
+# From phpcompatinfo report for version 1.0
Requires: php-pcre
Requires: php-spl
Requires: php-reflection
@@ -58,8 +70,6 @@ Requires: php-reflection
Requires: php-composer(fedora/autoloader)
Provides: php-composer(mockery/mockery) = %{version}
-Provides: php-pear(pear.survivethedeepend.com/Mockery) = %{version}
-Obsoletes: php-channel-deepend <= 1.3
%description
@@ -67,17 +77,26 @@ Mockery is a simple but flexible PHP mock object framework for use in unit
testing. It is inspired by Ruby's flexmock and Java's Mockito, borrowing
elements from both of their APIs.
-To use this library, you just have to add, in your project:
- require_once '%{_datadir}/php/Mockery/autoload.php';
+Autoloader: %{_datadir}/php/%{ns_project}%{major}/autoload.php
%prep
%setup -q -n %{gh_project}-%{gh_commit}
-cp %{SOURCE1} library/Mockery/autoload.php
+mv library/*.php library/%{ns_project}/
+phpab --template fedora --output library/%{ns_project}/autoload.php library
+
+cat << 'EOF' | tee -a library/%{ns_project}/autoload.php
+
+\Fedora\Autoloader\Dependencies::required([
+ '/usr/share/php/Hamcrest2/autoload.php',
+]);
+EOF
+
%patch0 -p0 -b .rpm
-%patch1 -p1
-%patch2 -p1
+%patch2 -p0 -b .test
+
+rm -f docs/.gitignore
%build
@@ -86,42 +105,45 @@ cp %{SOURCE1} library/Mockery/autoload.php
%install
mkdir -p %{buildroot}/%{_datadir}/php
-cp -rp library/* %{buildroot}/%{_datadir}/php/
+cp -rp library/%{ns_project} %{buildroot}/%{_datadir}/php/%{ns_project}%{major}
%check
%if %{with_tests}
: Use installed tree and our autoloader
-sed -e 's:@BUILD@:%{buildroot}/%{_datadir}/php:' -i tests/Bootstrap.php
+export COMPOSER_VENDOR_DIR=%{buildroot}%{_datadir}/php/%{ns_project}%{major}
: Run upstream test suite
ret=0
-for cmd in php php56 php70 php71 php72; do
- if which $cmd; then
- $cmd %{_bindir}/phpunit --verbose || ret=1
- fi
+for cmd in "php %{phpunit}" php70 php71 php72; do
+ if which $cmd; then
+ set $cmd
+ $1 ${2:-%{_bindir}/phpunit6} \
+ --no-coverage \
+ --verbose || ret=1
+ fi
done
exit $ret
%endif
-%post
-if [ -x %{_bindir}/pear ]; then
- %{_bindir}/pear uninstall --nodeps --ignore-errors --register-only \
- pear.survivethedeepend.com/Mockery >/dev/null || :
-fi
-
%files
%{!?_licensedir:%global license %%doc}
%license LICENSE
-%doc README.md docs
+%doc *.md docs
%doc composer.json
-%{_datadir}/php/Mockery/
-%{_datadir}/php/Mockery.php
+%{_datadir}/php/%{ns_project}%{major}
%changelog
+* Mon Jan 22 2018 Remi Collet <remi@remirepo.net> - 1.0-1
+- Update to 1.0
+- rename to php-mockery and move to /usr/share/php/Mockery1
+- raise dependency on PHP 5.6
+- raise dependency on hamcrest/hamcrest-php 2.0
+- use phpunit6 on F26+
+
* Fri Oct 6 2017 Remi Collet <remi@remirepo.net> - 0.9.9-4
- add patches for PHP 7.2