[Bug 1982616] Review Request: php-beberlei-assert - Thin assertion library for input validation in business models

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



https://bugzilla.redhat.com/show_bug.cgi?id=1982616



--- Comment #3 from Remi Collet <fedora@xxxxxxxxxxxxxxxxx> ---
Here is some possible changes

+++ php-beberlei-assert.spec    2021-07-20 09:07:23.444053501 +0200
@@ -11,7 +11,7 @@

 # PHP namespace and directory
 %global ns_project  Assert
-%global ns_dir      %( echo "%{ns_project}" | sed  's|\\\\|\/|g' )
+%global ns_dir      %{vendor}/%( echo "%{ns_project}" | sed  's|\\\\|\/|g' )

 # Github
 %global gh_vendor   beberlei
@@ -20,7 +20,7 @@
 %global scommit     %(c=%{commit}; echo ${c:0:7})

 # tests
-%global with_tests  1
+%bcond_without tests

 #-- PREAMBLE
------------------------------------------------------------------#
 Name:           php-%{vendor}-%{project}
@@ -30,7 +30,8 @@

 License:        BSD
 URL:            https://github.com/%{gh_vendor}/%{gh_project}
-Source0:       
https://github.com/%{gh_vendor}/%{gh_project}/archive/%{commit}/%{gh_project}-%{version}-%{scommit}.tar.gz
+Source0:        %{name}-%{version}-%{scommit}.tgz
+Source1:        makesrc.sh

 BuildArch:      noarch

@@ -57,8 +58,18 @@
 BuildRequires:  %{_bindir}/php
 BuildRequires:  php(language) >= 7.0

-%if 0%{?with_tests}
-# for tests
+%if %{with tests}
+BuildRequires:  phpunit9
+BuildRequires:  php-simplexml
+BuildRequires:  php-mbstring
+BuildRequires:  php-ctype
+BuildRequires:  php-json
+BuildRequires:  php-intl
+BuildRequires:  php-date
+BuildRequires:  php-filter
+BuildRequires:  php-pcre
+BuildRequires:  php-reflection
+BuildRequires:  php-spl
 %endif

 # composer provides
@@ -94,13 +105,9 @@
 \Fedora\Autoloader\Autoload::addPsr4('%{ns_project}', __DIR__);

 // files & dependencies
-\Fedora\Autoloader\Dependencies::required(array(
+\Fedora\Autoloader\Dependencies::required([
   __DIR__.'/functions.php',
-));
-
-\Fedora\Autoloader\Dependencies::optional(array(
-  // no optional dependencies
-));
+]);
 EOF

 %check
@@ -113,16 +120,29 @@
         ? 0 : 1
     );
 "
-%if 0%{?with_tests}
+%if %{with tests}
 : Run tests
-: No tests implemented
+mkdir vendor
+cat << 'EOF' | tee vendor/autoload.php
+<?php
+require_once '%{buildroot}%{_datadir}/php/%{ns_dir}/autoload.php';
+\Fedora\Autoloader\Autoload::addPsr4('%{ns_project}\\Tests',
dirname(__DIR__).'/tests/Assert/Tests');
+\Fedora\Autoloader\Dependencies::required([
+       '%{_datadir}/php/Yoast/PHPUnitPolyfills/autoload.php',
+    dirname(__DIR__).'/tests/Assert/Tests/Fixtures/functions.php',
+]);
+EOF
+
+phpunit9 --migrate-configuration
+phpunit9 --verbose
 %endif

 #-- FILES
---------------------------------------------------------------------#
 %files
 %license LICENSE
 %doc composer.json
-%{_datadir}/php/%{ns_dir}
+%doc *md
+%{_datadir}/php/%{vendor}


 #-- CHANGELOG
-----------------------------------------------------------------#



Using this, during the build:

+ phpunit9 --verbose
PHPUnit 9.5.7 by Sebastian Bergmann and contributors.

Runtime:       PHP 7.4.21
Configuration:
/dev/shm/extras/BUILD/assert-5e721d7e937ca3ba2cdec1e1adf195f9e5188372/phpunit.xml.dist

...................................................................................................................................................................
163 / 513 ( 31%)
...................................................................................................................................................................
326 / 513 ( 63%)
...................................................................................................................................................................
489 / 513 ( 95%)
........................                                                       
                                                                               
    513 / 513 (100%)

Time: 00:00.026, Memory: 10.00 MB

OK (513 tests, 904 assertions)


-- 
You are receiving this mail because:
You are on the CC list for the bug.
You are always notified about changes to this product and component
_______________________________________________
package-review mailing list -- package-review@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to package-review-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/package-review@xxxxxxxxxxxxxxxxxxxxxxx
Do not reply to spam on the list, report it: https://pagure.io/fedora-infrastructure




[Index of Archives]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite Conditions]     [KDE Users]

  Powered by Linux