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/upgrade_packages'
Browse files Browse the repository at this point in the history
  • Loading branch information
holyshared committed Nov 8, 2015
2 parents 5b3e077 + bb2d4c9 commit 702ad5a
Show file tree
Hide file tree
Showing 111 changed files with 795 additions and 1,042 deletions.
42 changes: 42 additions & 0 deletions .php_cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?php

use Symfony\CS\Config\Config;
use Symfony\CS\Finder\DefaultFinder;
use Symfony\CS\FixerInterface;

$fixers = [
'extra_empty_lines',
'no_blank_lines_after_class_opening',
'no_empty_lines_after_phpdocs',
'operators_spaces',
'phpdoc_indent',
'phpdoc_no_empty_return',
'phpdoc_no_package',
'phpdoc_params',
'phpdoc_separation',
'phpdoc_to_comment',
'phpdoc_trim',
'phpdoc_var_without_name',
'remove_leading_slash_use',
'remove_lines_between_uses',
'return',
'single_array_no_trailing_comma',
'spaces_before_semicolon',
'spaces_cast',
'standardize_not_equal',
'ternary_spaces',
'whitespacy_lines',
'ordered_use',
'short_array_syntax'
];

$finder = DefaultFinder::create();
$finder->in(__DIR__)
->exclude('spec/fixtures');

$config = Config::create()
->level(FixerInterface::PSR2_LEVEL)
->finder($finder)
->fixers($fixers);

return $config;
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ php:
- hhvm
before_script:
- travis_retry composer self-update
- travis_retry composer install --no-interaction --prefer-source --dev
- travis_retry composer install --no-interaction --prefer-source
script:
- composer test
after_script: composer coveralls
matrix:
fast_finish: true
notifications:
email: false
sudo: false
3 changes: 0 additions & 3 deletions RoboFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,11 @@
use coverallskit\CoverallsReportBuilder;
use holyshared\peridot\robo\loadTasks as PeridotTasks;


/**
* Class RoboFile
*/
class RoboFile extends Tasks
{

use PeridotTasks;

public function specAll()
Expand Down Expand Up @@ -63,5 +61,4 @@ public function exampleHhvm()

return $this->taskExec($command)->run();
}

}
13 changes: 7 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,23 @@
"require": {
"php": ">=5.5.0",
"phpcollection/phpcollection": "~0.4",
"guzzlehttp/guzzle": "~6.0",
"guzzlehttp/guzzle": "~6.1",
"gitonomy/gitlib": "~0.1",
"yosymfony/toml": "~0.3",
"symfony/dom-crawler": "~2.7",
"symfony/css-selector": "~2.7",
"zendframework/zend-config": "~2.5",
"zendframework/zend-console": "~2.5",
"eloquent/pathogen": "~0.6",
"easyframework/collections": "~4.0"
"easyframework/collections": "~4.1"
},
"require-dev": {
"phpspec/prophecy": "~1.4",
"peridot-php/peridot": "~1.15",
"phpspec/prophecy": "~1.5",
"peridot-php/peridot": "~1.16",
"expect/peridot-expect-plugin": "~3.0",
"cloak/peridot-cloak-plugin": "~2.0",
"holyshared/robo-peridot": "~2.0",
"codegyre/robo": "~0.5",
"codegyre/robo": "~0.6",
"peridot-php/peridot-dot-reporter": "~1.0",
"holyshared/peridot-file-fixture-plugin": "~1.0",
"holyshared/peridot-temporary-plugin": "~1.0"
Expand All @@ -41,6 +41,7 @@
"scripts": {
"test": "vendor/bin/robo spec:all",
"coveralls": "vendor/bin/robo spec:coveralls",
"coveralls-save-only": "vendor/bin/robo spec:coveralls-save-only"
"coveralls-save-only": "vendor/bin/robo spec:coveralls-save-only",
"style": "php-cs-fixer fix --config-file"
}
}
15 changes: 7 additions & 8 deletions example/basic_example.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@

use coverallskit\CoverallsReportBuilder;
use coverallskit\entity\CIService;
use coverallskit\Environment;
use coverallskit\environment\TravisCI;
use coverallskit\entity\GitRepository;
use coverallskit\entity\CoverageResult;
use coverallskit\entity\GitRepository;
use coverallskit\entity\SourceFile;
use coverallskit\Environment;
use coverallskit\environment\TravisCI;

/**
/*
* Get the code coverage
*/
xdebug_start_code_coverage(XDEBUG_CC_UNUSED | XDEBUG_CC_DEAD_CODE);
Expand All @@ -22,11 +22,10 @@
$result = xdebug_get_code_coverage();
xdebug_stop_code_coverage();


/**
/*
* Generate a json file
*/
$travis = new TravisCI( new Environment($_SERVER) );
$travis = new TravisCI(new Environment($_SERVER));
$service = new CIService($travis);

$builder = new CoverallsReportBuilder();
Expand All @@ -44,7 +43,7 @@
foreach ($coverage as $line => $status) {
if ($status === 1) {
$source->addCoverage(CoverageResult::executed($line));
} else if ($status === -1) {
} elseif ($status === -1) {
$source->addCoverage(CoverageResult::unused($line));
}
}
Expand Down
16 changes: 7 additions & 9 deletions example/hhvm_example.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@

use coverallskit\CoverallsReportBuilder;
use coverallskit\entity\CIService;
use coverallskit\Environment;
use coverallskit\environment\TravisCI;
use coverallskit\entity\GitRepository;
use coverallskit\entity\CoverageResult;
use coverallskit\entity\GitRepository;
use coverallskit\entity\SourceFile;
use coverallskit\Environment;
use coverallskit\environment\TravisCI;


/**
/*
* Get the code coverage
*/
fb_enable_code_coverage();
Expand All @@ -23,11 +22,10 @@
$result = fb_get_code_coverage(true);
fb_disable_code_coverage();


/**
/*
* Generate a json file
*/
$travis = new TravisCI( new Environment($_SERVER) );
$travis = new TravisCI(new Environment($_SERVER));
$service = new CIService($travis);

$builder = new CoverallsReportBuilder();
Expand All @@ -45,7 +43,7 @@
foreach ($coverage as $line => $status) {
if ($status === 1) {
$source->addCoverage(CoverageResult::executed($line));
} else if ($status === -1) {
} elseif ($status === -1) {
$source->addCoverage(CoverageResult::unused($line));
}
}
Expand Down
7 changes: 3 additions & 4 deletions peridot.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
<?php

use cloak\peridot\CloakPlugin;
use Evenement\EventEmitterInterface;
use expect\peridot\ExpectPlugin;
use cloak\peridot\CloakPlugin;
use Peridot\Reporter\Dot\DotReporterPlugin;
use holyshared\peridot\FileFixturePlugin;
use holyshared\peridot\temporary\TemporaryPlugin;
use Peridot\Reporter\Dot\DotReporterPlugin;

return function(EventEmitterInterface $emitter)
{
return function (EventEmitterInterface $emitter) {
$dot = new DotReporterPlugin($emitter);
ExpectPlugin::create()->registerTo($emitter);
TemporaryPlugin::create()->registerTo($emitter);
Expand Down
20 changes: 9 additions & 11 deletions spec/AttributePopulatable.spec.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/

namespace coverallskit\spec;

use coverallskit\AttributePopulatable;
Expand Down Expand Up @@ -38,26 +37,25 @@ public function __get($name)
{
return $this->$name;
}

}

describe(AttributePopulatable::class, function() {
describe('populate', function() {
context('when the specified attribute', function() {
beforeEach(function() {
describe(AttributePopulatable::class, function () {
describe('populate', function () {
context('when the specified attribute', function () {
beforeEach(function () {
$this->subject = new AttributePopulatableObject([ 'name' => 'foo', 'content' => 'bar' ]);
});
it('should populate object attributes', function() {
it('should populate object attributes', function () {
expect($this->subject->name)->toEqual('foo');
});
it('should call the setter', function() {
it('should call the setter', function () {
expect($this->subject->content)->toEqual('bar');
expect($this->subject->setterCalled)->toBeTrue();
});
});
context('when the specified attribute that does not exist', function() {
it('should throw coverallskit\exception\BadAttributeException', function() {
expect(function() {
context('when the specified attribute that does not exist', function () {
it('should throw coverallskit\exception\BadAttributeException', function () {
expect(function () {
new AttributePopulatableObject([ 'description' => 'foo' ]);
})->toThrow(BadAttributeException::class);
});
Expand Down
60 changes: 29 additions & 31 deletions spec/BuilderConfiguration.spec.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,22 @@
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/

namespace coverallskit\spec;

use coverallskit\BuilderConfiguration;
use coverallskit\CoverallsReportBuilder;
use coverallskit\entity\ServiceEntity;
use coverallskit\entity\RepositoryEntity;
use coverallskit\entity\ServiceEntity;
use coverallskit\exception\FileNotFoundException;
use coverallskit\exception\NotSupportFileTypeException;
use Prophecy\Argument;
use Zend\Config\Config;

describe(BuilderConfiguration::class, function () {

describe(BuilderConfiguration::class, function() {

describe('__construct', function() {
context('when specify the attribute', function() {
beforeEach(function() {
describe('__construct', function () {
context('when specify the attribute', function () {
beforeEach(function () {
$config = new Config([
'reportFile' => [
'input' => [
Expand All @@ -41,30 +39,30 @@

$this->configration = new BuilderConfiguration($config);
});
it('should set the name', function() {
it('should set the name', function () {
expect($this->configration->getReportFileName())->toEqual(getcwd() . '/coveralls.json');
});
it('return code coverage report file type', function() {
it('return code coverage report file type', function () {
expect($this->configration->getCoverageReportFileType())->toEqual('clover');
});
it('return code coverage report file name', function() {
it('return code coverage report file name', function () {
$filePath = realpath(__DIR__ . '/../') . '/clover.xml';
expect($this->configration->getCoverageReportFilePath())->toEqual($filePath);
});
it('should set the coveralls api token', function() {
it('should set the coveralls api token', function () {
expect($this->configration->getToken())->toEqual('api-token');
});
it('should set the service instance', function() {
it('should set the service instance', function () {
expect($this->configration->getService())->toBeAnInstanceOf(ServiceEntity::class);
});
it('should set the repository', function() {
it('should set the repository', function () {
expect($this->configration->getRepository())->toBeAnInstanceOf(RepositoryEntity::class);
});
});
});

describe('applyTo', function() {
beforeEach(function() {
describe('applyTo', function () {
beforeEach(function () {
$this->rootDirectory = realpath(__DIR__ . '/../');
$this->tmpDirectory = $this->rootDirectory . '/spec/tmp/';
$this->fixtureDirectory = $this->rootDirectory . '/spec/fixtures/';
Expand Down Expand Up @@ -95,46 +93,46 @@

$this->report = $this->builder->build();
});
it('apply report name config', function() {
it('apply report name config', function () {
expect($this->report->getName())->toEqual(realpath(__DIR__ . '/../') . '/coveralls.json');
});
it('apply service config', function() {
it('apply service config', function () {
expect($this->report->getService())->toBeAnInstanceOf(ServiceEntity::class);
});
it('apply repository config', function() {
it('apply repository config', function () {
expect($this->report->getRepository())->toBeAnInstanceOf(RepositoryEntity::class);
});
it('apply clover report config', function() {
it('apply clover report config', function () {
$sourceFiles = $this->report->getSourceFiles();
expect($sourceFiles->isEmpty())->toBeFalse();
});
});

describe('loadFromFile', function() {
context('when the file exists', function() {
context('when .toml', function() {
beforeEach(function() {
describe('loadFromFile', function () {
context('when the file exists', function () {
context('when .toml', function () {
beforeEach(function () {
$this->config = BuilderConfiguration::loadFromFile(__DIR__ . '/fixtures/coveralls.toml');
});
it('should return coverallskit\BuilderConfiguration instance', function() {
it('should return coverallskit\BuilderConfiguration instance', function () {
expect($this->config)->toBeAnInstanceOf(BuilderConfiguration::class);
});
it('should configration has report name', function() {
it('should configration has report name', function () {
$path = realpath(__DIR__ . '/fixtures') . '/coveralls.json';
expect($this->config->getReportFileName())->toEqual($path);
});
});
});
context('when the file not exists', function() {
it('should throw coverallskit\exception\FileNotFoundException', function() {
expect(function() {
context('when the file not exists', function () {
it('should throw coverallskit\exception\FileNotFoundException', function () {
expect(function () {
BuilderConfiguration::loadFromFile(__DIR__ . '/fixtures/not_found_coveralls.yml');
})->toThrow(FileNotFoundException::class);
});
});
context('when the file not support', function() {
it('should throw coverallskit\exception\NotSupportFileTypeException', function() {
expect(function() {
context('when the file not support', function () {
it('should throw coverallskit\exception\NotSupportFileTypeException', function () {
expect(function () {
BuilderConfiguration::loadFromFile(__DIR__ . '/fixtures/coveralls.ini');
})->toThrow(NotSupportFileTypeException::class);
});
Expand Down

0 comments on commit 702ad5a

Please sign in to comment.