Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Misc QA fixes for review #1

Merged
merged 4 commits into from over 2 years ago

3 participants

Daniel O'Connor Till! Christian Weiske
Daniel O'Connor
Owner

So; with Jenkins now available - how do we feel about phpunit 3.6, a build.xml (implying ant), dropping AllTests, etc?

Till!
Owner

I don't mind either. Maybe we can pre-process this before the job runs?

Pull request looks good: +1

Christian Weiske
Owner

I'd rather use phing than ant, but I'm ok with dropping alltests (as long as we have something that pear can use with run-tests )

Daniel O'Connor
Owner

@till - when you say preprocess; what do you mean?
@cweiske - pear run-tests supports phpunit AllTests out of the box? Or at least can be told "pear run-tests tests/AllTests.php" and have it treat it like a normal PHP file? What does it do with the results?

Daniel O'Connor CloCkWeRX merged commit 6c339be into from November 06, 2011
Daniel O'Connor CloCkWeRX closed this November 06, 2011
Till!
Owner

@ClockWerx: I mean, I wouldn't go through all packages and delete AllTests.php now. I'd tell people it's not necessary anymore so new packages don't do it or current packages can update when they get around to it.

Also, I'd probably try to leverage a phpunit.xml (somehow) because it makes bootstrapping tests with phpunit very simple.

Generally, I'm not sure how jenkins is being setup, but maybe that part would just do whatever is necessary to run tests.

Daniel O'Connor
Owner

@till - I agree - I've been doing two main types of jobs.

  1. phpunit --with-lots -of flags tests/[AllTests.php if needed]
  2. build.xml + phpunit.xml when there are external libraries; and the jenkins build has ~3+ custom commands to manage it.
Christian Weiske
Owner
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
2  Console/Getargs.php
@@ -224,7 +224,7 @@ class Console_Getargs
224 224
     function &factory($config = array(), $arguments = null)
225 225
     {
226 226
         // Create the options object.
227  
-        $obj = & new Console_Getargs_Options();
  227
+        $obj = new Console_Getargs_Options();
228 228
 
229 229
         // Try to set up the arguments.
230 230
         $err = $obj->init($config, $arguments);
42  build.xml
... ...
@@ -0,0 +1,42 @@
  1
+<?xml version="1.0"?>
  2
+<project name="Console_GetArgs" default="build" basedir=".">
  3
+	<condition property="phpunit.bin" value="phpunit.bat" else="phpunit">
  4
+        <os family="windows"/>
  5
+    </condition>
  6
+
  7
+	<condition property="pear.bin" value="pear.bat" else="pear">
  8
+        <os family="windows"/>
  9
+    </condition>
  10
+
  11
+	<target name="clean" description="Clean up and create artifact directories">
  12
+		<delete dir="${basedir}/lib" />
  13
+		<delete dir="${basedir}/build/api"/>
  14
+		<delete dir="${basedir}/build/code-browser"/>
  15
+		<delete dir="${basedir}/build/coverage"/>
  16
+		<delete dir="${basedir}/build/logs"/>
  17
+		<delete dir="${basedir}/build/pdepend"/>
  18
+		<delete dir="${basedir}/build"/>
  19
+
  20
+		<mkdir dir="${basedir}/lib/" />
  21
+		<mkdir dir="${basedir}/build"/>
  22
+		<mkdir dir="${basedir}/build/api"/>
  23
+		<mkdir dir="${basedir}/build/code-browser"/>
  24
+		<mkdir dir="${basedir}/build/coverage"/>
  25
+		<mkdir dir="${basedir}/build/logs"/>
  26
+		<mkdir dir="${basedir}/build/pdepend"/>
  27
+	</target>
  28
+
  29
+	<target name="phpunit">
  30
+		<exec dir="${basedir}" executable="${phpunit.bin}" failonerror="true">
  31
+			<arg line="."/>
  32
+		</exec>
  33
+	</target>
  34
+
  35
+	<target name="package">
  36
+		<exec dir="${basedir}/build" executable="${pear.bin}" failonerror="true">
  37
+			<arg line="package ../package.xml"/>
  38
+		</exec>
  39
+	</target>
  40
+
  41
+	<target name="build" depends="clean,phpunit,package"/>
  42
+</project>
58  package.xml
... ...
@@ -1,5 +1,5 @@
1 1
 <?xml version="1.0" encoding="UTF-8"?>
2  
-<package packagerversion="1.9.0" version="2.0" xmlns="http://pear.php.net/dtd/package-2.0" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0 http://pear.php.net/dtd/tasks-1.0.xsd http://pear.php.net/dtd/package-2.0 http://pear.php.net/dtd/package-2.0.xsd">
  2
+<package packagerversion="1.9.4" version="2.0" xmlns="http://pear.php.net/dtd/package-2.0" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0 http://pear.php.net/dtd/tasks-1.0.xsd http://pear.php.net/dtd/package-2.0 http://pear.php.net/dtd/package-2.0.xsd">
3 3
  <name>Console_Getargs</name>
4 4
  <channel>pear.php.net</channel>
5 5
  <summary>A command-line arguments parser</summary>
@@ -25,11 +25,11 @@ based on the given configuration.</description>
25 25
   <email>wenz@php.net</email>
26 26
   <active>no</active>
27 27
  </developer>
28  
- <date>2010-10-11</date>
29  
- <time>16:40:03</time>
  28
+ <date>2011-11-06</date>
  29
+ <time>13:11:30</time>
30 30
  <version>
31  
-  <release>1.3.5</release>
32  
-  <api>1.3.5</api>
  31
+  <release>1.3.6</release>
  32
+  <api>1.3.6</api>
33 33
  </version>
34 34
  <stability>
35 35
   <release>stable</release>
@@ -37,26 +37,19 @@ based on the given configuration.</description>
37 37
  </stability>
38 38
  <license uri="http://www.php.net/license">PHP License</license>
39 39
  <notes>
40  
-  QA release.
41  
-  * removed some coding style erros
42  
-  * fixed bug #2599 2 parameters for CVS example
43  
-  * fixed bug #2600 Parameter with '=argument"   
44  
-  * fixed bug #4091 New method: getValues()
45  
-  * fixed bug #9252 No error when required arguments are missing
46  
-  * fixed bug #9583 Console Args isDefined not working correctly
47  
-  * fixed bug #10609 wrong require_once in doc
48  
-  * fixed bug #13605 fix unit tests to work with phpunit3
  40
+QA Release.
  41
+Upgrade to phpunit 3.6
49 42
  </notes>
50 43
  <contents>
51 44
   <dir baseinstalldir="/" name="/">
52  
-   <file baseinstalldir="/" name="Console/Getargs.php" role="php">
53  
-     <replace from="@package_version@" to="version" type="package-info" />
  45
+   <file baseinstalldir="/" md5sum="0906cc9b6eea315b36487c9680471bf1" name="Console/Getargs.php" role="php">
  46
+    <tasks:replace from="@package_version@" to="version" type="package-info" />
54 47
    </file>
55  
-   <file baseinstalldir="Console" name="examples/example.php" role="doc" />
56  
-   <file baseinstalldir="Console" name="examples/example2.php" role="doc" />
57  
-   <file baseinstalldir="/" name="tests/AllTests.php" role="test" />
58  
-   <file baseinstalldir="Console" name="tests/Getargs_basic_testcase.php" role="test" />
59  
-   <file baseinstalldir="" name="tests/Getargs_getValues_testcase.php" role="test" />
  48
+   <file baseinstalldir="Console" md5sum="6a5651269cfaa096143c02426c070ae6" name="examples/example.php" role="doc" />
  49
+   <file baseinstalldir="Console" md5sum="8b053b550ce74b06f7b000906df47f8f" name="examples/example2.php" role="doc" />
  50
+   <file baseinstalldir="/" md5sum="ae35d76786d4753954495f05f2935a3b" name="tests/Getargs_BasicTest.php" role="test" />
  51
+   <file baseinstalldir="/" md5sum="32ada775f0d4d8bee604bbe08298d61b" name="tests/Getargs_getValuesTest.php" role="test" />
  52
+   <file baseinstalldir="/" md5sum="c6adc2abcd57bf1315a6619032335dc0" name="README" role="data" />
60 53
   </dir>
61 54
  </contents>
62 55
  <dependencies>
@@ -68,6 +61,13 @@ based on the given configuration.</description>
68 61
     <min>1.4.0b1</min>
69 62
    </pearinstaller>
70 63
   </required>
  64
+  <optional>
  65
+   <package>
  66
+    <name>PHPUnit</name>
  67
+    <channel>pear.phpunit.de</channel>
  68
+    <min>3.6.0</min>
  69
+   </package>
  70
+  </optional>
71 71
  </dependencies>
72 72
  <phprelease />
73 73
  <changelog>
@@ -229,5 +229,21 @@ Fix for bug #9252: No error when required arguments are missing.
229 229
 Update to package2.xml
230 230
    </notes>
231 231
   </release>
  232
+  <release>
  233
+   <version>
  234
+    <release>1.3.6</release>
  235
+    <api>1.3.6</api>
  236
+   </version>
  237
+   <stability>
  238
+    <release>stable</release>
  239
+    <api>stable</api>
  240
+   </stability>
  241
+   <date>2011-11-06</date>
  242
+   <license uri="http://www.php.net/license">PHP License</license>
  243
+   <notes>
  244
+QA Release.
  245
+Upgrade to phpunit 3.6
  246
+   </notes>
  247
+  </release>
232 248
  </changelog>
233 249
 </package>
21  phpunit.xml
... ...
@@ -0,0 +1,21 @@
  1
+<?xml version="1.0"?>
  2
+<phpunit verbose="true">
  3
+	<logging>
  4
+		<log type="coverage-html" target="build/coverage" title="Console_GetArgs" charset="UTF-8" yui="true" highlight="true" lowUpperBound="35" highLowerBound="70"/>
  5
+		<log type="coverage-clover" target="build/logs/clover.xml"/>
  6
+		<log type="junit" target="build/logs/junit.xml" logIncompleteSkipped="false" title="Console_GetArgs"/>
  7
+	</logging>
  8
+	<filter>
  9
+		<blacklist>
  10
+			<directory suffix=".php">/usr/share/php</directory>
  11
+			<directory suffix=".php">tests/unit/</directory>
  12
+		</blacklist>
  13
+	</filter>
  14
+	<testsuites>
  15
+		<testsuite>
  16
+			<directory>tests</directory>
  17
+			<file>*Test.php</file>
  18
+		</testsuite>
  19
+	</testsuites>
  20
+	<php><includePath>lib/</includePath></php>
  21
+</phpunit>
56  tests/AllTests.php
... ...
@@ -1,56 +0,0 @@
1  
-<?php
2  
-/* vim: set expandtab tabstop=4 shiftwidth=4: */
3  
-// +----------------------------------------------------------------------+
4  
-// | PHP Version 4                                                        |
5  
-// +----------------------------------------------------------------------+
6  
-// | Copyright (c) 2004 The PHP Group                                     |
7  
-// +----------------------------------------------------------------------+
8  
-// | This source file is subject to version 3.0 of the PHP license,       |
9  
-// | that is bundled with this package in the file LICENSE, and is        |
10  
-// | available through the world-wide-web at the following url:           |
11  
-// | http://www.php.net/license/3_0.txt.                                  |
12  
-// | If you did not receive a copy of the PHP license and are unable to   |
13  
-// | obtain it through the world-wide-web, please send a note to          |
14  
-// | license@php.net so we can mail you a copy immediately.               |
15  
-// +----------------------------------------------------------------------+
16  
-// | Author: Bertrand Mansion <bmansion@mamasam.com>                      |
17  
-// +----------------------------------------------------------------------+
18  
-//
19  
-// $Id$
20  
-
21  
-/**
22  
- * Unit tests for Console_Getargs package.
23  
- */
24  
-if (!defined('PHPUnit_MAIN_METHOD')) {
25  
-    define('PHPUnit_MAIN_METHOD', 'Console_Getargs_AllTests::main');
26  
-}
27  
-
28  
-require_once 'PHPUnit/TextUI/TestRunner.php';
29  
-
30  
-
31  
-chdir(dirname(__FILE__) . '/../');
32  
-require_once 'Getargs_basic_testcase.php';
33  
-require_once 'Getargs_getValues_testcase.php';
34  
-
35  
-class Console_Getargs_AllTests
36  
-{
37  
-    public static function main()
38  
-    {
39  
-        PHPUnit_TextUI_TestRunner::run(self::suite());
40  
-    }
41  
-
42  
-    public static function suite()
43  
-    {
44  
-        $suite = new PHPUnit_Framework_TestSuite('Console_Getargs Tests');
45  
-        /** Add testsuites, if there is. */
46  
-        $suite->addTestSuite('Getargs_basic_testcase');
47  
-        $suite->addTestSuite('Getargs_getValues_testcase');
48  
-
49  
-        return $suite;
50  
-    }
51  
-}
52  
-
53  
-if (PHPUnit_MAIN_METHOD == 'Console_Getargs_AllTests::main') {
54  
-    Console_Getargs_AllTests::main();
55  
-}
56  
-?>
4  tests/Getargs_basic_testcase.php → tests/Getargs_BasicTest.php
@@ -22,13 +22,13 @@
22 22
 }
23 23
 
24 24
 require_once 'Console/Getargs.php';
25  
-require_once 'PHPUnit/Framework.php';
  25
+require_once 'PHPUnit/Framework/TestCase.php';
26 26
 
27 27
 /**
28 28
  * Unit tests for Console_Getargs package.
29 29
  */
30 30
 
31  
-class Getargs_Basic_testCase extends PHPUnit_Framework_TestCase
  31
+class Getargs_BasicTest extends PHPUnit_Framework_TestCase
32 32
 {
33 33
     /**
34 34
      * Runs the test methods of this class.
6  tests/Getargs_getValues_testcase.php → tests/Getargs_getValuesTest.php
@@ -26,7 +26,7 @@
26 26
 }
27 27
 
28 28
 require_once 'Console/Getargs.php';
29  
-require_once 'PHPUnit/Framework.php';
  29
+require_once 'PHPUnit/Framework/TestCase.php';
30 30
 
31 31
 /**
32 32
  * getValues Test case for Console_Getargs
@@ -40,7 +40,7 @@
40 40
  * @version    Release: @package_version@
41 41
  * @link       http://pear.php.net/package/Console_Getargs
42 42
  */
43  
-class Getargs_getValues_testCase extends PHPUnit_Framework_TestCase
  43
+class Getargs_getValuesTest extends PHPUnit_Framework_TestCase
44 44
 {
45 45
     /**
46 46
      * Runs the test methods of this class.
@@ -294,4 +294,4 @@ function testMultiple()
294 294
     Getargs_getValues_testCase::main();
295 295
 }
296 296
 
297  
-?>
  297
+?>
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.