Commits

Anonymous committed 382a1e2 Merge

Comments (0)

Files changed (8)

 # A sample Guardfile
 # More info at https://github.com/guard/guard#readme
 
-guard 'phpunit', :cli => '--colors', :tests_path => 'tests',
+guard 'phpunit', :cli => '--colors', :tests_path => '-c tests',
         :keep_failed => true, :all_after_pass => true, :command => "./vendor/bin/phpunit" do
   watch(%r{^tests/.+Test\.php$})
   watch(%r{^src/(.+)\.php$}) { |m| "tests/#{m[1]}Test.php" }
 
 Notes
 =====
+[2012-12-19]
+
+Change autoload to PSR-0 in src/
+Reorganize phpunit.xml files and ant task
 
 [2012-12-07]
 
 
 If you want to use the vendor PHPUnit, to generate code coverage report (needs install xdebug extension)
 
-$ bin/phpunit
+$ bin/phpunit -c tests
 
 If you want to use ant (and only phpunit task)
 
 
 $ bin/phpunit -c phpunit-codecoverage.xml.dist
 
-$ ant phpunit-codecoverage
+$ ant 
 
 You should remove "Acme" namespace ;)
 
 
 <project name="skeleton_php_project" default="build" basedir=".">
  <property name="source" value="src"/>
+ <property name="tests" value="tests"/>
 
  <target name="clean" description="Clean up and create artifact directories">
   <delete dir="${basedir}/build/coverage"/>
  </target>
 
  <target name="phpunit" description="Run unit tests using PHPUnit and generates junit.xml and clover.xml">
-  <exec executable="bin/phpunit" failonerror="true"/>
+     <exec executable="${basedir}/bin/phpunit" failonerror="true" dir="${basedir}/${tests}">
+  </exec>
  </target>
 
  <target name="phpunit-codecoverage" description="Run unit tests using PHPUnit and generates junit.xml and clover.xml">
-  <exec executable="bin/phpunit" failonerror="true">
-      <arg line="-c ${basedir}/phpunit-codecoverage.xml.dist"/>
+     <exec executable="bin/phpunit" failonerror="true">
+         <arg line="-c ${basedir}/${tests}/phpunit-codecoverage.xml.dist" />
   </exec>
  </target>
- <target name="build" depends="clean,phpunit"/>
- <!-- <target name="build" depends="clean,phpunit-codecoverage"/>-->
+ <target name="build" depends="clean,phpunit-codecoverage"/>
 </project>
     },
     "autoload": {
         "psr-0": {
-            "Acme": "src/"
+            "": "src/"
         }
     },
     "config": {

phpunit-codecoverage.xml.dist

-<?xml version="1.0" encoding="UTF-8"?>
-<phpunit bootstrap="tests/TestHelper.php"
-         backupGlobals="false"
-         backupStaticAttributes="false"
-         strict="true"
-         colors="true"
-         verbose="true">
-  <testsuites>
-    <testsuite name="skeleton_php_project">
-      <directory suffix="Test.php">tests</directory>
-    </testsuite>
-  </testsuites>
-  <logging>
-    <log type="coverage-html" target="build/coverage" title="skeleton PHP project"
-         charset="UTF-8" yui="true" highlight="true"
-         lowUpperBound="35" highLowerBound="70"/>
-    <log type="coverage-clover" target="build/logs/clover.xml"/>
-    <log type="junit" target="build/logs/junit.xml" logIncompleteSkipped="false"/>
-  </logging>
-  <filter>
-    <whitelist addUncoveredFilesFromWhitelist="true">
-      <directory suffix=".php">src</directory>
-      <exclude>
-          <file suffix=".php">src/bootstrap.php</file>
-      </exclude>
-    </whitelist>
-  </filter>
-</phpunit>

phpunit.xml.dist

-<?xml version="1.0" encoding="UTF-8"?>
-<phpunit bootstrap="tests/TestHelper.php"
-         backupGlobals="false"
-         backupStaticAttributes="false"
-         strict="true"
-         colors="true"
-         verbose="true">
-  <testsuites>
-    <testsuite name="skeleton_php_project">
-        <directory suffix="Test.php">tests</directory>
-    </testsuite>
-  </testsuites>
-</phpunit>

tests/phpunit-codecoverage.xml.dist

+<?xml version="1.0" encoding="UTF-8"?>
+<phpunit bootstrap="./TestHelper.php"
+         backupGlobals="false"
+         backupStaticAttributes="false"
+         strict="true"
+         colors="true"
+         verbose="true">
+  <testsuites>
+    <testsuite name="skeleton_php_project">
+      <directory suffix="Test.php">.</directory>
+    </testsuite>
+  </testsuites>
+  <logging>
+      <log type="coverage-html" target="../build/coverage" title="skeleton PHP project"
+         charset="UTF-8" yui="true" highlight="true"
+         lowUpperBound="35" highLowerBound="70"/>
+     <log type="coverage-clover" target="../build/logs/clover.xml"/>
+     <log type="junit" target="../build/logs/junit.xml" logIncompleteSkipped="false"/>
+  </logging>
+  <filter>
+    <whitelist addUncoveredFilesFromWhitelist="true">
+      <directory suffix=".php">../src</directory>
+      <exclude>
+          <file suffix=".php">../src/bootstrap.php</file>
+      </exclude>
+    </whitelist>
+  </filter>
+</phpunit>

tests/phpunit.xml.dist

+<?xml version="1.0" encoding="UTF-8"?>
+<phpunit bootstrap="./TestHelper.php"
+         backupGlobals="false"
+         backupStaticAttributes="false"
+         strict="true"
+         colors="true"
+         verbose="true">
+  <testsuites>
+    <testsuite name="skeleton_php_project">
+        <directory suffix="Test.php">.</directory>
+    </testsuite>
+  </testsuites>
+</phpunit>
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.