Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Add coveralls support and fix a few testing bugs related to coverage #4397

Closed
wants to merge 3 commits into from

6 participants

@DASPRiD
Collaborator

This PR adds coveralls support (https://coveralls.io/) to ZF2. This tool integrates nicely with both GitHub and Travis, and allows us to keep track of our code coverage.

In the same run I fixed a few broken @covers annotations and a bug which prevented complete testing on Ubuntu 12.04 (see comments in the diff).

Coveralls status can be found at https://coveralls.io/r/zendframework/zf2

@DASPRiD
Collaborator

Mhh, something's still wrong with composer it seems.

@satooshi

Please try to set src_dir: library in .coveralls.yml.

@DASPRiD
Collaborator

Oh indeed, I totally forgot that we have "library" as source folder, thanks.

@DASPRiD
Collaborator

Oh, just saw that you are the developer of php-coveralls, nice work on that!

@coveralls

Coverage Status

Changes Unknown when pulling 43e9a61 on DASPRiD:feature/coveralls-support into ** on zendframework:master**.

@Ocramius Ocramius commented on the diff
composer.json
@@ -8,6 +8,27 @@
],
"homepage": "http://framework.zend.com/",
"license": "BSD-3-Clause",
+ "repositories": [
@Ocramius Collaborator
Ocramius added a note

huh?

@prolic
prolic added a note

phpcov comes without composer support. perhabs someone can make a PR there first?

@Ocramius Collaborator
Ocramius added a note

For sure a requirement before this goes in

@DASPRiD Collaborator
DASPRiD added a note

Well, at least we are already on a stable tag here ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@Ocramius Ocramius commented on the diff
composer.json
@@ -16,7 +37,9 @@
"ircmaxell/random-lib": "dev-master",
"ircmaxell/security-lib": "dev-master",
"ocramius/proxy-manager": "0.3.*",
- "phpunit/PHPUnit": "3.7.*"
+ "phpunit/PHPUnit": "3.7.*",
+ "satooshi/php-coveralls": "dev-master",
@Ocramius Collaborator
Ocramius added a note

use a stable tag please

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@DASPRiD
Collaborator

Related issue, should be fixed soon (as in, today or tomorrow):
lemurheavy/coveralls-public#51

@weierophinney weierophinney referenced this pull request from a commit
@weierophinney weierophinney [#4397] CS fixes
- EOF ending
- trailing whitespace
712f14b
@weierophinney

Merged to develop for 2.3.0 release.

@weierophinney weierophinney referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
@weierophinney weierophinney referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
@weierophinney weierophinney referenced this pull request from a commit in zendframework/zend-http
@weierophinney weierophinney Merge pull request zendframework/zf2#4397 from DASPRiD/feature/covera…
…lls-support

Add coveralls support and fix a few testing bugs related to coverage
4eaed60
@weierophinney weierophinney referenced this pull request from a commit in zendframework/zend-http
@weierophinney weierophinney Merge branch 'feature/4397' into develop 7172f83
@weierophinney weierophinney referenced this pull request from a commit in zendframework/zend-validator
@weierophinney weierophinney Merge pull request zendframework/zf2#4397 from DASPRiD/feature/covera…
…lls-support

Add coveralls support and fix a few testing bugs related to coverage
c983e9a
@weierophinney weierophinney referenced this pull request from a commit in zendframework/zend-validator
@weierophinney weierophinney Merge branch 'feature/4397' into develop c552cbc
@weierophinney weierophinney referenced this pull request from a commit in zendframework/zend-i18n-resources
@weierophinney weierophinney Merge pull request zendframework/zf2#4397 from DASPRiD/feature/covera…
…lls-support

Add coveralls support and fix a few testing bugs related to coverage
60511e4
@weierophinney weierophinney referenced this pull request from a commit in zendframework/zend-i18n-resources
@weierophinney weierophinney [zendframework/zf2#4397] CS fixes
- EOF ending
- trailing whitespace
d41b9bd
@weierophinney weierophinney referenced this pull request from a commit in zendframework/zend-i18n-resources
@weierophinney weierophinney Merge branch 'feature/4397' into develop ccca4d8
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.
View
2  .coveralls.yml
@@ -0,0 +1,2 @@
+src_dir: library
+
View
3  .travis.yml
@@ -16,6 +16,9 @@ before_install:
script:
- ant travis -keep-going
+after_script:
+ - php vendor/bin/coveralls
+
notifications:
irc: "irc.freenode.org#zftalk.dev"
email: false
View
8 README.md
@@ -1,7 +1,11 @@
### Welcome to the *Zend Framework 2.2* Release!
-Master: [![Build Status](https://secure.travis-ci.org/zendframework/zf2.png?branch=master)](http://travis-ci.org/zendframework/zf2)
-Develop: [![Build Status](https://secure.travis-ci.org/zendframework/zf2.png?branch=develop)](http://travis-ci.org/zendframework/zf2)
+Master:
+[![Build Status](https://secure.travis-ci.org/zendframework/zf2.png?branch=master)](http://travis-ci.org/zendframework/zf2)
+[![Coverage Status](https://coveralls.io/repos/zendframework/zf2/badge.png?branch=master)](https://coveralls.io/r/zendframework/zf2)
+Develop:
+[![Build Status](https://secure.travis-ci.org/zendframework/zf2.png?branch=develop)](http://travis-ci.org/zendframework/zf2)
+[![Coverage Status](https://coveralls.io/repos/zendframework/zf2/badge.png?branch=develop)](https://coveralls.io/r/zendframework/zf2)
## RELEASE INFORMATION
View
22 build.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="ZF2" default="build">
- <target name="travis" depends="tests-parallel,show-test-results" />
+ <target name="travis" depends="tests-parallel,merge-clover,show-test-results" />
<target name="clean" description="Cleanup build artifacts">
<delete dir="${basedir}/build"/>
@@ -9,6 +9,8 @@
<target name="prepare" depends="clean" description="Prepare for build">
<mkdir dir="${basedir}/build/test-results"/>
<mkdir dir="${basedir}/build/cs-results"/>
+ <mkdir dir="${basedir}/build/coverage"/>
+ <mkdir dir="${basedir}/build/logs"/>
</target>
<target name="get-cs-fixer" depends="clean" description="Get coding standards fixer">
@@ -31,6 +33,22 @@
</sequential>
</target>
+ <target name="merge-clover" description="Merges the individual clover reports of each component into a single clover.xml">
+ <sequential>
+ <exec executable="php" failonerror="true">
+ <arg value="-d" />
+ <arg value="memory_limit=-1" />
+ <arg value="vendor/bin/phpcov.php" />
+ <arg value="--merge" />
+ <arg value="--clover" />
+ <arg value="${basedir}/build/logs/clover.xml" />
+ <arg value="--whitelist" />
+ <arg value="${basedir}/library" />
+ <arg value="${basedir}/build/coverage" />
+ </exec>
+ </sequential>
+ </target>
+
<target
name="tests-parallel"
depends="prepare,composer-install,get-cs-fixer"
@@ -118,6 +136,8 @@
>
<arg value="-c" />
<arg value="${basedir}/tests/phpunit.xml.dist" />
+ <arg value="--coverage-php" />
+ <arg value="${basedir}/build/coverage/coverage-@{component}.cov" />
<arg value="${basedir}/tests/ZendTest/@{component}" />
</exec>
</sequential>
View
25 composer.json
@@ -8,6 +8,27 @@
],
"homepage": "http://framework.zend.com/",
"license": "BSD-3-Clause",
+ "repositories": [
@Ocramius Collaborator
Ocramius added a note

huh?

@prolic
prolic added a note

phpcov comes without composer support. perhabs someone can make a PR there first?

@Ocramius Collaborator
Ocramius added a note

For sure a requirement before this goes in

@DASPRiD Collaborator
DASPRiD added a note

Well, at least we are already on a stable tag here ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ {
+ "type": "package",
+ "package": {
+ "name": "sebastianbergmann/phpcov",
+ "version": "1.1.0",
+ "dist": {
+ "url": "https://github.com/sebastianbergmann/phpcov/archive/1.1.0.zip",
+ "type": "zip"
+ },
+ "source": {
+ "url": "https://github.com/sebastianbergmann/phpcov.git",
+ "type": "git",
+ "reference": "1.1.0"
+ },
+ "bin": [
+ "phpcov.php"
+ ]
+ }
+ }
+ ],
"require": {
"php": ">=5.3.3"
},
@@ -16,7 +37,9 @@
"ircmaxell/random-lib": "dev-master",
"ircmaxell/security-lib": "dev-master",
"ocramius/proxy-manager": "0.3.*",
- "phpunit/PHPUnit": "3.7.*"
+ "phpunit/PHPUnit": "3.7.*",
+ "satooshi/php-coveralls": "dev-master",
@Ocramius Collaborator
Ocramius added a note

use a stable tag please

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ "sebastianbergmann/phpcov": "1.1.0"
},
"suggest": {
"ext-intl": "ext/intl for i18n features (included in default builds of PHP)",
View
6 tests/ZendTest/Http/Header/AcceptTest.php
@@ -282,7 +282,7 @@ public function testWildcardWithDifferentParamsAndRanges()
/**
* @group 3739
- * @covers Accept::matchAcceptParams()
+ * @covers Zend\Http\Header\AbstractAccept::matchAcceptParams()
*/
public function testParamRangesWithDecimals()
{
@@ -293,8 +293,8 @@ public function testParamRangesWithDecimals()
/**
* @group 3740
* @dataProvider provideParamRanges
- * @covers Accept::matchAcceptParams()
- * @covers Accept::getParametersFromFieldValuePart()
+ * @covers Zend\Http\Header\AbstractAccept::matchAcceptParams()
+ * @covers Zend\Http\Header\AbstractAccept::getParametersFromFieldValuePart()
*/
public function testParamRangesSupportDevStage($range, $input, $success)
{
View
4 tests/ZendTest/Mvc/Controller/ControllerManagerTest.php
@@ -62,8 +62,8 @@ public function testInjectControllerDependenciesWillNotOverwriteExistingEventMan
}
/**
- * @covers ControllerManager::has
- * @covers ControllerManager::get
+ * @covers Zend\ServiceManager\ServiceManager::has
+ * @covers Zend\ServiceManager\AbstractPluginManager::get
*/
public function testDoNotUsePeeringServiceManagers()
{
View
5 tests/ZendTest/Validator/File/IsCompressedTest.php
@@ -33,6 +33,11 @@ protected function getMagicMime()
return __DIR__ . '/_files/magic.lte.5.3.10.mime';
}
+ // Ubuntu has backported the changes in 12.04 to PHP 5.3.10.
+ if (strpos(PHP_VERSION, 'ubuntu') !== false && version_compare(PHP_VERSION, '5.3.10', '>=')) {
+ return __DIR__ . '/_files/magic.lte.5.3.10.mime';
+ }
+
return __DIR__ . '/_files/magic.mime';
}
View
5 tests/ZendTest/Validator/File/IsImageTest.php
@@ -31,6 +31,11 @@ protected function getMagicMime()
return __DIR__ . '/_files/magic.lte.5.3.10.mime';
}
+ // Ubuntu has backported the changes in 12.04 to PHP 5.3.10.
+ if (strpos(PHP_VERSION, 'ubuntu') !== false && version_compare(PHP_VERSION, '5.3.10', '>=')) {
+ return __DIR__ . '/_files/magic.lte.5.3.10.mime';
+ }
+
return __DIR__ . '/_files/magic.mime';
}
Something went wrong with that request. Please try again.