Skip to content
This repository has been archived by the owner on Aug 17, 2023. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'origin/develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
holyshared committed Apr 28, 2015
2 parents f3c2aa5 + 7941cce commit e9afb6b
Show file tree
Hide file tree
Showing 108 changed files with 1,137 additions and 1,019 deletions.
2 changes: 1 addition & 1 deletion .cloak.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
includes = ["src"]

# Exclude source files.
excludes = ["vendor", "spec"]
excludes = ["vendor", "spec", "peridot.php"]

[report]
reportDirectory = "./tmp"
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
/vendor/
tmp
spec/tmp/clover.xml
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ language: php
php:
- 5.6
- 5.5
- 5.4
- hhvm
- hhvm-nightly
before_script:
Expand Down
31 changes: 31 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,37 @@
Change Log
===================================

2.0.0
-----------------------------------
* PHP5.4 not support
* Rename CompositeEntityInterface.php -> CompositeEntity.php
* Rename EntityInterface.php -> Entity.php
* Rename CompositeEntityCollectionInterface.php -> CompositeEntityCollection
* Raname CoverageInterface -> CoverageEntity
* Raname Coverage -> CoverageResult
* Raname RepositoryInterface -> RepositoryEntity
* Raname Repository -> GitRepository
* Raname ServiceInterface -> ServiceEntity
* Raname Service -> CIService
* Raname ReportInterface -> ReportEntity
* Raname Report -> CoverallsReport
* Raname AdaptorInterface -> EnviromentAdaptor
* Raname RecordInterface -> FileRecord
* Raname ReportParserInterface -> ReportParser
* Raname ReportBuilder -> CoverallsReportBuilder
* Raname ReportBuilderInterface -> ReportBuilder
* Rename ReportTransfer -> CoverallsReportTransfer
* Rename ReportTransferInterface -> ReportTransfer
* Rename ReportTransferAwareInterface -> ReportTransferAware
* Rename Configuration -> BuilderConfiguration
* Rename ConfigurationInterface -> Configuration
* Rename RootConfigurationInterface -> RootConfiguration
* Rename ConfigurationLoaderInterface -> ConfigurationLoader
* Rename Registry -> ObjectRegistry
* Changed the dom parser from Zend\Dom to Symfony\DomCrawler
* Changed the interface of the report parser


1.4.0.3
-----------------------------------
* Upgrade peridot (1.9 > 1.8)
Expand Down
61 changes: 1 addition & 60 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,60 +1 @@
CoverallsKit====================================[![Build Status](https://travis-ci.org/cloak-php/coveralls-kit.svg?branch=master)](https://travis-ci.org/cloak-php/coveralls-kit)
[![Build Status](https://drone.io/github.com/cloak-php/coveralls-kit/status.png)](https://drone.io/github.com/cloak-php/coveralls-kit/latest)
[![Circle CI](https://circleci.com/gh/cloak-php/coveralls-kit.svg?style=svg)](https://circleci.com/gh/cloak-php/coveralls-kit)
[![Build Status](https://codeship.com/projects/af9497a0-70ab-0132-4b61-227a26fe7ed7/status?branch=master)](https://codeship.com/projects/54536)


[![Latest Stable Version](https://poser.pugx.org/cloak/coverallskit/v/stable.svg)](https://packagist.org/packages/cloak/coverallskit) [![Total Downloads](https://poser.pugx.org/cloak/coverallskit/downloads.svg)](https://packagist.org/packages/cloak/coverallskit) [![Latest Unstable Version](https://poser.pugx.org/cloak/coverallskit/v/unstable.svg)](https://packagist.org/packages/cloak/coverallskit) [![License](https://poser.pugx.org/cloak/coverallskit/license.svg)](https://packagist.org/packages/cloak/coverallskit)
[![Stories in Ready](https://badge.waffle.io/cloak-php/coveralls-kit.png?label=ready&title=Ready)](https://waffle.io/cloak-php/coveralls-kit)[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/cloak-php/coveralls-kit/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/cloak-php/coveralls-kit/?branch=master)[![Coverage Status](https://coveralls.io/repos/cloak-php/coveralls-kit/badge.png)](https://coveralls.io/r/cloak-php/coveralls-kit)[![Dependency Status](https://www.versioneye.com/user/projects/53fd5949f4df154965000002/badge.svg?style=flat)](https://www.versioneye.com/user/projects/53fd5949f4df154965000002)
**CoverallsKit** is the library for transmitting the report of code coverage to **coveralls**. This library works with **PHP5.4** or more.Requirements------------------------------------* PHP >= 5.4* Xdebug >= 2.2.2Installation
------------------------------------
Installation that uses the composer.

1. Install the [composer](https://getcomposer.org/).
2. Install the package.

composer require cloak/coverallskit --dev
Basic usage------------------------------------You can generate a json file using the **coverallskit/ReportBuilder**. You just set the code coverage of rows that have been executed. Code coverage can be obtained easily by using the **HHVM** and **xdebug**.```php$builder = new ReportBuilder();$builder->token('your repository token') ->service(new TravisCI( new Environment($_SERVER) )) ->repository(new Repository(__DIR__ . '/../'));$source = new SourceFile('path/to/file');$source->addCoverage(Coverage::executed(1)); //The first line was executed$source->addCoverage(Coverage::unused(2)); //The second line is not executed$source->addCoverage(Coverage::executed(3)); //The third line is executed$builder->addSource($source);$builder->build()->saveAs(__DIR__ . '/tmp/coverage.json');```Using a configuration file-----------------------------------If you use a configuration file, you can send the report more easily.```phpuse coverallskit\Configuration;
use coverallskit\ReportBuilder;

$configration = Configuration::loadFromFile('coveralls.toml');
$builder = ReportBuilder::fromConfiguration($configration);
$builder->build()->save()->upload();
```Configration file format-----------------------------------It is also possible to use a configuration file. The file format is **toml format**.
```toml
token = "{api-token}"
service = "travis-ci"
repositoryDirectory = "."

[reportFile]
output = "script/coveralls.json"

[reportFile.input]
type = "lcov"
file = "script/report.lcov"
```


### File format
| Name | Required | Default | Description |
|:--------------------|------------:|:---------------|:--------------------------------------------------|
| token | optional | **COVERALLS_REPO_TOKEN** | [coveralls.io](https://coveralls.io/docs/api) api token. If you do not specify, use the environment variable **COVERALLS_REPO_TOKEN**. |
| service | optional | **travis-ci** | CI(Continuous Integration) service name. You can use the **travis-ci** or **travis-pro** or **circle-ci** or **drone.io** or **codeship** |
| reportFile | optional | | Please look at the **reportFile section**. |
| repositoryDirectory | optional | . | Directory path of the **git repository**. Will specify a relative path from the directory containing the configuration file. |

#### reportFile

##### imput

| Name | Required | Default | Description |
|:--------------------|------------:|:---------------|:--------------------------------------------------|
| type | optional | | Will specify the file type in the code coverage report. You can specify the **lcov** or **clover**. |
| file | optional | coveralls.json | Will specify a file of code coverage report. |

##### output

will specify the json file name to be sent to the [coveralls.io](https://coveralls.io/docs/api).
Will specify a relative path from the directory containing the configuration file.

Task for Robo---------------------------------------------------------------------------------Support the [robo](https://github.com/Codegyre/Robo) of tasks, so you can easily send a report. Please look at the [robo-coveralls-kit](https://github.com/cloak-php/robo-coveralls-kit) for more information.Detailed documentation-----------------------------------* [Work with Travis-CI](docs/travis-ci.md)Run only unit test------------------------------------ composer testHow to run the example------------------------------------ vendor/bin/robo example:basic
CoverallsKit====================================[![Build Status](https://travis-ci.org/cloak-php/coveralls-kit.svg?branch=master)](https://travis-ci.org/cloak-php/coveralls-kit)[![Build Status](https://drone.io/github.com/cloak-php/coveralls-kit/status.png)](https://drone.io/github.com/cloak-php/coveralls-kit/latest)[![Circle CI](https://circleci.com/gh/cloak-php/coveralls-kit.svg?style=svg)](https://circleci.com/gh/cloak-php/coveralls-kit)[![Build Status](https://codeship.com/projects/af9497a0-70ab-0132-4b61-227a26fe7ed7/status?branch=master)](https://codeship.com/projects/54536)[![Stories in Ready](https://badge.waffle.io/cloak-php/coveralls-kit.png?label=ready&title=Ready)](https://waffle.io/cloak-php/coveralls-kit)[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/cloak-php/coveralls-kit/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/cloak-php/coveralls-kit/?branch=master)[![Coverage Status](https://coveralls.io/repos/cloak-php/coveralls-kit/badge.png)](https://coveralls.io/r/cloak-php/coveralls-kit)[![Dependency Status](https://www.versioneye.com/user/projects/53fd5949f4df154965000002/badge.svg?style=flat)](https://www.versioneye.com/user/projects/53fd5949f4df154965000002)[![Latest Stable Version](https://poser.pugx.org/cloak/coverallskit/v/stable.svg)](https://packagist.org/packages/cloak/coverallskit) [![License](https://poser.pugx.org/cloak/coverallskit/license.svg)](https://packagist.org/packages/cloak/coverallskit)**CoverallsKit** is the library for transmitting the report of code coverage to **coveralls**. This library works with **PHP5.5** or more.Requirements------------------------------------* PHP >= 5.5* Xdebug >= 2.2.2Installation------------------------------------Installation that uses the composer.1. Install the [composer](https://getcomposer.org/).2. Install the package. composer require cloak/coverallskit --devBasic usage------------------------------------You can generate a json file using the **coverallskit/CoverallsReportBuilder**. You just set the code coverage of rows that have been executed. Code coverage can be obtained easily by using the **HHVM** and **xdebug**.```php$travis = new TravisCI( new Environment($_SERVER) );$service = new CIService($travis);$builder = new CoverallsReportBuilder();$builder->token('your repository token') ->service($service) ->repository(new GitRepository(__DIR__ . '/../'));$source = new SourceFile('path/to/file');$source->addCoverage(CoverageResult::executed(1)); //The first line was executed$source->addCoverage(CoverageResult::unused(2)); //The second line is not executed$source->addCoverage(CoverageResult::executed(3)); //The third line is executed$builder->addSource($source);$builder->build()->saveAs(__DIR__ . '/tmp/coverage.json');```Using a configuration file-----------------------------------If you use a configuration file, you can send the report more easily.```phpuse coverallskit\BuilderConfiguration;use coverallskit\CoverallsReportBuilder;$configuration = BuilderConfiguration::loadFromFile('coveralls.toml');$builder = CoverallsReportBuilder::fromConfiguration($configuration);$builder->build()->save()->upload();```Configuration file format-----------------------------------It is also possible to use a configuration file. The file format is **toml format**.```tomltoken = "{api-token}"service = "travis-ci"repositoryDirectory = "."[reportFile]output = "script/coveralls.json"[reportFile.input]type = "lcov"file = "script/report.lcov"```### File format| Name | Required | Default | Description ||:--------------------|------------:|:---------------|:--------------------------------------------------|| token | optional | **COVERALLS_REPO_TOKEN** | [coveralls.io](https://coveralls.io/docs/api) api token. If you do not specify, use the environment variable **COVERALLS_REPO_TOKEN**. || service | optional | **travis-ci** | CI(Continuous Integration) service name. You can use the **travis-ci** or **travis-pro** or **circle-ci** or **drone.io** or **codeship** || reportFile | optional | | Please look at the **reportFile section**. || repositoryDirectory | optional | . | Directory path of the **git repository**. Will specify a relative path from the directory containing the configuration file. |#### reportFile##### imput| Name | Required | Default | Description ||:--------------------|------------:|:---------------|:--------------------------------------------------|| type | optional | | Will specify the file type in the code coverage report. You can specify the **lcov** or **clover**. || file | optional | coveralls.json | Will specify a file of code coverage report. |##### outputwill specify the json file name to be sent to the [coveralls.io](https://coveralls.io/docs/api). Will specify a relative path from the directory containing the configuration file.Task for Robo---------------------------------------------------------------------------------Support the [robo](https://github.com/Codegyre/Robo) of tasks, so you can easily send a report. Please look at the [robo-coveralls-kit](https://github.com/cloak-php/robo-coveralls-kit) for more information.Detailed documentation-----------------------------------* [Work with Travis-CI](docs/travis-ci.md)Run only unit test------------------------------------ composer testHow to run the example------------------------------------ vendor/bin/robo example:basic
Expand Down
8 changes: 4 additions & 4 deletions RoboFile.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

use \Robo\Tasks;
use coverallskit\Configuration;
use coverallskit\ReportBuilder;
use coverallskit\BuilderConfiguration;
use coverallskit\CoverallsReportBuilder;
use peridot\robo\loadTasks as PeridotTasks;


Expand All @@ -26,8 +26,8 @@ public function specAll()

public function specCoveralls()
{
$configuration = Configuration::loadFromFile('.coveralls.toml');
$builder = ReportBuilder::fromConfiguration($configuration);
$configuration = BuilderConfiguration::loadFromFile('.coveralls.toml');
$builder = CoverallsReportBuilder::fromConfiguration($configuration);
$builder->build()->save()->upload();
}

Expand Down
2 changes: 1 addition & 1 deletion circle.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
machine:
php:
version: 5.4.21
version: 5.5.11
dependencies:
pre:
- sudo composer self-update
Expand Down
14 changes: 9 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
{
"name": "cloak/coverallskit",
"description": "Transmitting the report of code coverage to coveralls.",
"description": "PHP client for coveralls.io",
"keywords": [
"coveralls", "code coverage", "report", "lcov", "clover"
],
"require": {
"php": ">=5.4.0",
"php": ">=5.5.0",
"phpcollection/phpcollection": "~0.4",
"guzzlehttp/guzzle": "~5.2",
"gitonomy/gitlib": "~0.1",
"yosymfony/toml": "~0.3",
"zendframework/zend-dom": "~2.4",
"symfony/dom-crawler": "~2.6",
"symfony/css-selector": "~2.6",
"zendframework/zend-config": "~2.4",
"zendframework/zend-console": "~2.4",
"eloquent/pathogen": "~0.6"
"eloquent/pathogen": "~0.6",
"easyframework/collections": "~4.0"
},
"require-dev": {
"phpspec/prophecy": "~1.4",
Expand All @@ -22,7 +24,9 @@
"cloak/peridot-cloak-plugin": "~1.3",
"robo-peridot/robo-peridot": "~1.1",
"codegyre/robo": "~0.5",
"peridot-php/peridot-dot-reporter": "~1.0"
"peridot-php/peridot-dot-reporter": "~1.0",
"holyshared/peridot-file-fixture-plugin": "~0.3",
"holyshared/peridot-temporary-plugin": "~0.4"
},
"license": "MIT",
"authors": [
Expand Down
22 changes: 13 additions & 9 deletions example/basic_example.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@

require_once __DIR__ . '/../vendor/autoload.php';

use coverallskit\ReportBuilder;
use coverallskit\entity\service\Travis\TravisCI;
use coverallskit\CoverallsReportBuilder;
use coverallskit\entity\CIService;
use coverallskit\Environment;
use coverallskit\entity\Repository;
use coverallskit\entity\Coverage;
use coverallskit\environment\TravisCI;
use coverallskit\entity\GitRepository;
use coverallskit\entity\CoverageResult;
use coverallskit\entity\SourceFile;

/**
Expand All @@ -25,10 +26,13 @@
/**
* Generate a json file
*/
$builder = new ReportBuilder();
$travis = new TravisCI( new Environment($_SERVER) );
$service = new CIService($travis);

$builder = new CoverallsReportBuilder();
$builder->token('foo')
->service(new TravisCI( new Environment($_SERVER) ))
->repository(new Repository(__DIR__ . '/../'));
->service($service)
->repository(new GitRepository(__DIR__ . '/../'));

foreach ($result as $file => $coverage) {
if (preg_match('/vendor/', $file) || preg_match('/src/', $file)) {
Expand All @@ -39,9 +43,9 @@

foreach ($coverage as $line => $status) {
if ($status === 1) {
$source->addCoverage(Coverage::executed($line));
$source->addCoverage(CoverageResult::executed($line));
} else if ($status === -1) {
$source->addCoverage(Coverage::unused($line));
$source->addCoverage(CoverageResult::unused($line));
}
}

Expand Down
22 changes: 13 additions & 9 deletions example/hhvm_example.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@

require_once __DIR__ . '/../vendor/autoload.php';

use coverallskit\ReportBuilder;
use coverallskit\CoverallsReportBuilder;
use coverallskit\entity\CIService;
use coverallskit\Environment;
use coverallskit\entity\service\travis\TravisCI;
use coverallskit\entity\Repository;
use coverallskit\entity\Coverage;
use coverallskit\environment\TravisCI;
use coverallskit\entity\GitRepository;
use coverallskit\entity\CoverageResult;
use coverallskit\entity\SourceFile;


Expand All @@ -26,10 +27,13 @@
/**
* Generate a json file
*/
$builder = new ReportBuilder();
$travis = new TravisCI( new Environment($_SERVER) );
$service = new CIService($travis);

$builder = new CoverallsReportBuilder();
$builder->token('foo')
->service(new TravisCI( new Environment($_SERVER) ))
->repository(new Repository(__DIR__ . '/../'));
->service($service)
->repository(new GitRepository(__DIR__ . '/../'));

foreach ($result as $file => $coverage) {
if (preg_match('/vendor/', $file) || preg_match('/src/', $file)) {
Expand All @@ -40,9 +44,9 @@

foreach ($coverage as $line => $status) {
if ($status === 1) {
$source->addCoverage(Coverage::executed($line));
$source->addCoverage(CoverageResult::executed($line));
} else if ($status === -1) {
$source->addCoverage(Coverage::unused($line));
$source->addCoverage(CoverageResult::unused($line));
}
}

Expand Down
6 changes: 6 additions & 0 deletions peridot.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,17 @@
use expect\peridot\ExpectPlugin;
use cloak\peridot\CloakPlugin;
use Peridot\Reporter\Dot\DotReporterPlugin;
use holyshared\peridot\FileFixturePlugin;
use holyshared\peridot\temporary\TemporaryPlugin;

return function(EventEmitterInterface $emitter)
{
$dot = new DotReporterPlugin($emitter);
ExpectPlugin::create()->registerTo($emitter);
TemporaryPlugin::create()->registerTo($emitter);

$fixturePlugin = new FileFixturePlugin(__DIR__ . '/spec/fixtures/.fixtures.toml');
$fixturePlugin->registerTo($emitter);

if (defined('HHVM_VERSION') === false) {
CloakPlugin::create('.cloak.toml')->registerTo($emitter);
Expand Down
5 changes: 3 additions & 2 deletions spec/AttributePopulatable.spec.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
namespace coverallskit\spec;

use coverallskit\AttributePopulatable;
use coverallskit\exception\BadAttributeException;
use Prophecy\Prophet;

class AttributePopulatableObject
Expand Down Expand Up @@ -40,7 +41,7 @@ public function __get($name)

}

describe('AttributePopulatable', function() {
describe(AttributePopulatable::class, function() {
describe('populate', function() {
context('when the specified attribute', function() {
beforeEach(function() {
Expand All @@ -58,7 +59,7 @@ public function __get($name)
it('should throw coverallskit\exception\BadAttributeException', function() {
expect(function() {
new AttributePopulatableObject([ 'description' => 'foo' ]);
})->toThrow('coverallskit\exception\BadAttributeException');
})->toThrow(BadAttributeException::class);
});
});
});
Expand Down

0 comments on commit e9afb6b

Please sign in to comment.