dev-php/PEAR-HTML_CSS: Revbump with tests, EAPI and eclass changes
authorBrian Evans <grknight@gentoo.org>
Fri, 16 Feb 2018 21:58:10 +0000 (16:58 -0500)
committerBrian Evans <grknight@gentoo.org>
Fri, 16 Feb 2018 22:00:16 +0000 (17:00 -0500)
Package-Manager: Portage-2.3.24, Repoman-2.3.6

dev-php/PEAR-HTML_CSS/PEAR-HTML_CSS-1.5.4-r1.ebuild [deleted file]
dev-php/PEAR-HTML_CSS/PEAR-HTML_CSS-1.5.4-r2.ebuild [new file with mode: 0644]
dev-php/PEAR-HTML_CSS/files/HTML_CSS-1.5.4-fix-tests.patch [new file with mode: 0644]

diff --git a/dev-php/PEAR-HTML_CSS/PEAR-HTML_CSS-1.5.4-r1.ebuild b/dev-php/PEAR-HTML_CSS/PEAR-HTML_CSS-1.5.4-r1.ebuild
deleted file mode 100644 (file)
index 0819717..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-# Copyright 1999-2014 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=5
-
-inherit php-pear-r1
-
-DESCRIPTION="Provides a simple interface for generating a stylesheet declaration"
-LICENSE="BSD"
-SLOT="0"
-KEYWORDS="~amd64 ~x86"
-IUSE="minimal"
-RDEPEND=">=dev-php/PEAR-HTML_Common-1.2.4
-       !minimal? ( >=dev-php/PEAR-Services_W3C_CSSValidator-0.1.0
-                   >=dev-php/phpunit-3.2.0 )"
diff --git a/dev-php/PEAR-HTML_CSS/PEAR-HTML_CSS-1.5.4-r2.ebuild b/dev-php/PEAR-HTML_CSS/PEAR-HTML_CSS-1.5.4-r2.ebuild
new file mode 100644 (file)
index 0000000..c9b8063
--- /dev/null
@@ -0,0 +1,27 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+inherit php-pear-r2
+
+DESCRIPTION="Provides a simple interface for generating a stylesheet declaration"
+LICENSE="BSD"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="minimal test"
+RDEPEND=">=dev-php/PEAR-HTML_Common-1.2.4
+       !minimal? ( >=dev-php/PEAR-Services_W3C_CSSValidator-0.1.0 )"
+DEPEND="test? ( ${RDEPEND} >=dev-php/phpunit-3.7 )"
+PATCHES=( "${FILESDIR}/HTML_CSS-1.5.4-fix-tests.patch" )
+
+src_prepare() {
+       mkdir HTML || die
+       mv CSS CSS.php HTML || die
+       default
+}
+
+src_test() {
+       ln -s ../HTML tests/HTML || die
+       phpunit tests/AllTests.php || die
+}
diff --git a/dev-php/PEAR-HTML_CSS/files/HTML_CSS-1.5.4-fix-tests.patch b/dev-php/PEAR-HTML_CSS/files/HTML_CSS-1.5.4-fix-tests.patch
new file mode 100644 (file)
index 0000000..410ad75
--- /dev/null
@@ -0,0 +1,112 @@
+diff -aurN a/tests/AllTests.php b/tests/AllTests.php
+--- a/tests/AllTests.php       1970-01-01 04:13:26.000000000 -0500
++++ b/tests/AllTests.php       2018-02-16 16:28:52.565010362 -0500
+@@ -24,7 +24,6 @@
+ \r
+ require_once 'HTML_CSS_TestSuite_Standard.php';\r
+ require_once 'HTML_CSS_TestSuite_Output.php';\r
+-require_once 'HTML_CSS_TestSuite_Bugs.php';\r
+ \r
+ /**\r
+  * Class for running all test suites for HTML_CSS package.\r
+@@ -79,7 +78,6 @@
+         $suite = new PHPUnit_Framework_TestSuite('HTML_CSS Test Suite');\r
+         $suite->addTestSuite('HTML_CSS_TestSuite_Standard');\r
+         $suite->addTestSuite('HTML_CSS_TestSuite_Output');\r
+-        $suite->addTestSuite('HTML_CSS_TestSuite_Bugs');\r
+         return $suite;\r
+     }\r
+ \r
+@@ -126,4 +124,4 @@
+ if (PHPUnit_MAIN_METHOD == 'HTML_CSS_AllTests::main') {\r
+     HTML_CSS_AllTests::main();\r
+ }\r
+-?>
+\ No newline at end of file
++?>\r
+diff -aurN a/tests/HTML_CSS_TestSuite_Output.php b/tests/HTML_CSS_TestSuite_Output.php
+--- a/tests/HTML_CSS_TestSuite_Output.php      1970-01-01 04:13:26.000000000 -0500
++++ b/tests/HTML_CSS_TestSuite_Output.php      2018-02-16 16:36:35.283820690 -0500
+@@ -18,7 +18,6 @@
+ \r
+ require_once "PHPUnit/Framework/TestCase.php";\r
+ require_once "PHPUnit/Framework/TestSuite.php";\r
+-require_once "PHPUnit/Extensions/OutputTestCase.php";\r
+ \r
+ require_once 'HTML/CSS.php';\r
+ require_once 'PEAR.php';\r
+@@ -34,7 +33,7 @@
+  * @link     http://pear.php.net/package/HTML_CSS\r
+  * @since    File available since Release 1.5.2\r
+  */\r
+-class HTML_CSS_TestSuite_Output extends PHPUnit_Extensions_OutputTestCase\r
++class HTML_CSS_TestSuite_Output extends PHPUnit_Framework_TestCase\r
+ {\r
+     /**\r
+      * A CSS object\r
+@@ -70,7 +69,12 @@
+ \r
+         $this->css = new HTML_CSS($attrs, $prefs);\r
+ \r
+-        $this->setOutputCallback(array(&$this, 'normalizeOutput'));\r
++        $this->setOutputCallback(array($this, 'normalizeOutput'));\r
++    }\r
++\r
++    protected function normalizeOutput($buffer)\r
++    {\r
++        return str_replace("\r", '', $buffer);\r
+     }\r
+ \r
+     /**\r
+@@ -153,4 +157,4 @@
+ if (PHPUnit_MAIN_METHOD == "HTML_CSS_TestSuite_Output::main") {\r
+     HTML_CSS_TestSuite_Output::main();\r
+ }\r
+-?>
+\ No newline at end of file
++?>\r
+diff -aurN a/tests/HTML_CSS_TestSuite_Standard.php b/tests/HTML_CSS_TestSuite_Standard.php
+--- a/tests/HTML_CSS_TestSuite_Standard.php    1970-01-01 04:13:26.000000000 -0500
++++ b/tests/HTML_CSS_TestSuite_Standard.php    2018-02-16 16:47:01.837374212 -0500
+@@ -117,12 +117,10 @@
+      */\r
+     public function catchError($error, $code, $level)\r
+     {\r
+-        $this->assertType(PHPUnit_Framework_Constraint_IsType::TYPE_OBJECT, $error);\r
+-        if ($error instanceof PEAR_Error) {\r
+-            $this->assertEquals($error->getCode(), $code);\r
+-            $user_info = $error->getUserInfo();\r
+-            $this->assertEquals($user_info['level'], $level);\r
+-        }\r
++        $this->assertInstanceOf(PEAR_Error::class, $error);\r
++        $this->assertEquals($error->getCode(), $code);\r
++        $user_info = $error->getUserInfo();\r
++        $this->assertEquals($user_info['level'], $level);\r
+     }\r
+ \r
+     /**\r
+@@ -724,7 +722,7 @@
+         $css_data = array($fn, $strcss);\r
+         $messages = array();\r
+ \r
+-        $stub = $this->getMock('HTML_CSS', array('validate'));\r
++        $stub = $this->createMock(HTML_CSS::class);\r
+         $stub->expects($this->any())\r
+              ->method('validate')\r
+              ->will($this->returnValue(true));\r
+@@ -1578,7 +1576,7 @@
+         $this->catchError($r, HTML_CSS_ERROR_INVALID_INPUT, 'exception');\r
+ \r
+         // validate\r
+-        $stub = $this->getMock('HTML_CSS', array('validate'));\r
++        $stub = $this->createMock(HTML_CSS::class);\r
+         $stub->expects($this->any())\r
+              ->method('validate')\r
+              ->will($this->returnCallback(array(&$this, 'cbMockValidator')));\r
+@@ -1680,4 +1678,4 @@
+ if (PHPUnit_MAIN_METHOD == "HTML_CSS_TestSuite_Standard::main") {\r
+     HTML_CSS_TestSuite_Standard::main();\r
+ }\r
+-?>
+\ No newline at end of file
++?>\r