ensure we use newly installed autoloader in buildroot

epel9
Remi Collet 8 years ago
parent 5036ef7966
commit 9a89a1d910

@ -0,0 +1,21 @@
diff --git a/tests/AutoloadTest.php b/tests/AutoloadTest.php
index c8e53e4..f71f150 100644
--- a/tests/AutoloadTest.php
+++ b/tests/AutoloadTest.php
@@ -89,6 +89,7 @@ class AutoloadTest extends \PHPUnit_Framework_TestCase
**/
public function testAddClassMapTemplateOrderBis()
{
+ $nb = count(Autoload::getClassMap());
$this->assertFalse(class_exists('Foo\\Bar'));
require __DIR__.'/fixtures/Foo2/classmap2.php';
require __DIR__.'/fixtures/Foo/classmap.php';
@@ -98,7 +99,7 @@ class AutoloadTest extends \PHPUnit_Framework_TestCase
$this->assertEquals('three', \Foo\Bar::order);
$classmap = Autoload::getClassMap();
- $this->assertEquals(2, count($classmap));
+ $this->assertEquals($nb+2, count($classmap));
$this->assertArrayHasKey(__DIR__.'/fixtures/Foo', $classmap);
$this->assertArrayHasKey(__DIR__.'/fixtures/Foo2', $classmap);
}

@ -32,7 +32,7 @@
Name: php-%{composer_vendor}-%{composer_project}
Version: %{github_version}
Release: 1%{?github_release}%{?dist}
Release: 2%{?github_release}%{?dist}
Summary: Fedora Autoloader
Group: Development/Libraries
@ -40,6 +40,8 @@ License: MIT
URL: https://github.com/%{github_owner}/%{github_name}
Source0: %{url}/archive/%{github_commit}/%{name}-%{github_version}-%{github_commit}.tar.gz
Patch0: %{name}.patch
BuildArch: noarch
# Tests
%if %{with_tests}
@ -47,6 +49,7 @@ BuildArch: noarch
BuildRequires: php(language) >= %{php_min_ver}
BuildRequires: php-composer(phpunit/phpunit)
BuildRequires: php-composer(theseer/autoload) >= %{phpab_min_ver}
BuildRequires: php-pear
## phpcompatinfo (computed from version 0.1.0)
BuildRequires: php-spl
%endif
@ -89,6 +92,8 @@ Provides needed tools to build other packages:
%prep
%setup -qn %{github_name}-%{github_commit}
%patch0 -p1 -b .upstream
: Set PHP directory in phpab template
sed "s#___AUTOLOAD_PATH___#'%{phpdir}/Fedora/Autoloader'#" \
-i res/phpab/fedora.php.tpl
@ -99,7 +104,6 @@ sed "s#___AUTOLOAD_PATH___#'%{phpdir}/Fedora/Autoloader'#" \
%install
: Main
mkdir -p %{buildroot}%{phpdir}/Fedora/Autoloader/Test
cp -rp src/* %{buildroot}%{phpdir}/Fedora/Autoloader/
@ -112,8 +116,14 @@ cp -p res/phpab/fedora.php.tpl %{buildroot}%{phpab_template_dir}/
%check
%if %{with_tests}
# drop to avoid duplicated class (used for boostrap)
if grep Fedora/Autoloader %{_datadir}/php/PHPUnit/Autoload.php; then
:> src/autoload.php
fi
: Run upstream test suite
%{_bindir}/phpunit --verbose
%{_bindir}/php -d include_path=.:%{buildroot}%{_datadir}/php:%{_datadir}/php:%{_datadir}/pear \
%{_bindir}/phpunit --verbose
%else
: Tests skipped
%endif
@ -133,6 +143,9 @@ cp -p res/phpab/fedora.php.tpl %{buildroot}%{phpab_template_dir}/
%changelog
* Sat Oct 22 2016 Remi Collet <remi@fedoraproject.org> - 0.1.2-2
- ensure we use newly installed autoloader in buildroot
* Fri Oct 21 2016 Remi Collet <remi@fedoraproject.org> - 0.1.2-1
- update to 0.1.2

Loading…
Cancel
Save