Skip to content
This repository has been archived by the owner on Sep 23, 2020. It is now read-only.

Commit

Permalink
vendor update, use composer scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
Dominik Zogg committed Nov 21, 2019
1 parent 80a41c8 commit 5d65def
Show file tree
Hide file tree
Showing 11 changed files with 108 additions and 67 deletions.
11 changes: 6 additions & 5 deletions .gitignore
@@ -1,6 +1,7 @@
phpunit/
vendor/
composer.lock
.php_cs.cache

.DS_Store
.idea/
.phpunit.result.cache
.vscode/
build/
composer.lock
vendor/
38 changes: 38 additions & 0 deletions .php_cs
@@ -0,0 +1,38 @@
<?php

$finder = PhpCsFixer\Finder::create()
->files()
->name('*.php')
->in(__DIR__ . '/src')
->in(__DIR__ . '/tests')
;

return PhpCsFixer\Config::create()
->setIndent(" ")
->setLineEnding("\n")
->setRules([
'@DoctrineAnnotation' => true,
'@PhpCsFixer' => true,
'@Symfony' => true,
'array_syntax' => ['syntax' => 'short'],
'declare_strict_types' => true,
'dir_constant' => true,
'final_class' => true,
'is_null' => true,
'linebreak_after_opening_tag' => true,
'list_syntax' => true,
'method_chaining_indentation' => false,
'no_php4_constructor' => true,
'ordered_interfaces' => true,
'php_unit_dedicate_assert_internal_type' => true,
'php_unit_dedicate_assert' => true,
'php_unit_expectation' => true,
'php_unit_mock' => true,
'php_unit_namespaced' => true,
'php_unit_no_expectation_annotation' => true,
'single_line_throw' => false,
'ternary_to_null_coalescing' => true,
])
->setRiskyAllowed(true)
->setFinder($finder)
;
22 changes: 16 additions & 6 deletions .travis.yml
Expand Up @@ -5,20 +5,30 @@ matrix:
- php: 7.0
env: dependencies=lowest
- php: 7.0
env: dependencies=highest
- php: 7.1
env: dependencies=lowest
- php: 7.1
env: dependencies=highest
- php: 7.2
env: dependencies=lowest
- php: 7.2
env: dependencies=highest
- php: 7.3
env: dependencies=lowest
- php: 7.3
- php: 7.4snapshot
env: dependencies=lowest
- php: 7.4snapshot
allow_failures:
- php: 7.4snapshot

before_script:
- echo 'extension=apcu.so' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/apcu.ini
- echo 'Europe/Zurich' | sudo tee /etc/timezone
- echo 'date.timezone = "Europe/Zurich"' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
- composer self-update -q
- if [ -z "$dependencies" ]; then composer install; fi;
- composer global require hirak/prestissimo
- if [ -z "$dependencies" ]; then composer update -n; fi;
- if [ "$dependencies" = "lowest" ]; then composer update --prefer-lowest -n; fi;
- if [ "$dependencies" = "highest" ]; then composer update -n; fi;

script: vendor/bin/phpunit --coverage-text --verbose
script:
- composer test
- vendor/bin/php-coveralls --coverage_clover=build/phpunit/phpunit.clover.xml --json_path=build/coveralls.json -v
13 changes: 6 additions & 7 deletions README.md
@@ -1,8 +1,7 @@
# chubbyphp-lazy-command

[![Build Status](https://api.travis-ci.org/chubbyphp/chubbyphp-lazy-command.png?branch=master)](https://travis-ci.org/chubbyphp/chubbyphp-lazy-command)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/chubbyphp/chubbyphp-lazy-command/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/chubbyphp/chubbyphp-lazy-command/?branch=master)
[![Code Coverage](https://scrutinizer-ci.com/g/chubbyphp/chubbyphp-lazy-command/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/chubbyphp/chubbyphp-lazy-command/?branch=master)
[![Coverage Status](https://coveralls.io/repos/github/chubbyphp/chubbyphp-lazy-command/badge.svg?branch=master)](https://coveralls.io/github/chubbyphp/chubbyphp-lazy-command?branch=master)
[![Total Downloads](https://poser.pugx.org/chubbyphp/chubbyphp-lazy-command/downloads.png)](https://packagist.org/packages/chubbyphp/chubbyphp-lazy-command)
[![Monthly Downloads](https://poser.pugx.org/chubbyphp/chubbyphp-lazy-command/d/monthly)](https://packagist.org/packages/chubbyphp/chubbyphp-lazy-command)
[![Latest Stable Version](https://poser.pugx.org/chubbyphp/chubbyphp-lazy-command/v/stable.png)](https://packagist.org/packages/chubbyphp/chubbyphp-lazy-command)
Expand All @@ -14,16 +13,16 @@ Allow to lazyload commands.

## Requirements

* php: ~7.0
* psr/container: ~1.0
* symfony/console: ~2.3|~3.0|~4.0
* php: ^7.0
* psr/container: ^1.0
* symfony/console: ^2.8|^3.4|^4.2|^5.0

## Installation

Through [Composer](http://getcomposer.org) as [chubbyphp/chubbyphp-lazy-command][1].

```sh
composer require chubbyphp/chubbyphp-lazy-command "~1.2"
composer require chubbyphp/chubbyphp-lazy-command "^1.3"
```

## Usage
Expand Down Expand Up @@ -89,4 +88,4 @@ $command->run();

## Copyright

Dominik Zogg 2016
Dominik Zogg 2019
31 changes: 26 additions & 5 deletions composer.json
Expand Up @@ -10,20 +10,41 @@
}
],
"require": {
"php": "~7.0",
"php": "^7.0",
"psr/container": "^1.0",
"symfony/console": "~2.3|~3.0|~4.0"
"symfony/console": "^2.8|^3.4|^4.2|^5.0"
},
"require-dev": {
"phpunit/phpunit": "^6.5.8",
"container-interop/container-interop": "~1.2"
"container-interop/container-interop": "^1.2",
"friendsofphp/php-cs-fixer": "^2.16",
"phpunit/phpunit": "^6.5.14|^7.5.17|^8.4.3",
"php-coveralls/php-coveralls": "^2.1",
"phploc/phploc": "^4.0.1||^5.0"
},
"autoload": {
"psr-4": { "Chubbyphp\\Lazy\\": "src/" }
},
"autoload-dev": {
"psr-4": { "Chubbyphp\\Tests\\Lazy\\": "tests/" }
},
"extra": {
"branch-alias": {
"dev-master": "1.2-dev"
"dev-master": "1.3-dev"
}
},
"scripts": {
"fix:cs": "mkdir -p build && vendor/bin/php-cs-fixer fix --cache-file=build/phpcs.cache",
"test": [
"@test:lint",
"@test:unit",
"@test:integration",
"@test:loc",
"@test:cs"
],
"test:cs": "mkdir -p build && vendor/bin/php-cs-fixer fix --dry-run --stop-on-violation --cache-file=build/phpcs.cache",
"test:integration": "vendor/bin/phpunit --testsuite=Integration",
"test:lint": "mkdir -p build && find src tests -name '*.php' -print0 | xargs -0 -n1 -P$(nproc) php -l | tee build/phplint.log",
"test:loc": "mkdir -p build && vendor/bin/phploc src --verbose | tee build/phploc.log",
"test:unit": "phpdbg -qrr vendor/bin/phpunit --testsuite=Unit --coverage-text --coverage-clover=build/phpunit/phpunit.clover.xml --coverage-html=build/phpunit/coverage-html --coverage-xml=build/phpunit/coverage-xml --log-junit=build/phpunit/phpunit.junit.xml"
}
}
13 changes: 6 additions & 7 deletions phpunit.xml.dist → phpunit.xml
Expand Up @@ -5,22 +5,21 @@
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
executionOrder="random"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false"
bootstrap="tests/bootstrap.php"
>
<testsuites>
<testsuite name="chubbyphp lazy command">
<directory>./tests</directory>
<testsuite name="Integration">
<directory>./tests/Integration</directory>
</testsuite>
<testsuite name="Unit">
<directory>./tests/Unit</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory>./src</directory>
</whitelist>
</filter>
<logging>
<log type="coverage-html" target="phpunit/coverage" />
</logging>
</phpunit>
6 changes: 0 additions & 6 deletions src/CommandAdapter.php
Expand Up @@ -15,18 +15,12 @@ final class CommandAdapter
*/
private $command;

/**
* @param Command $command
*/
public function __construct(Command $command)
{
$this->command = $command;
}

/**
* @param InputInterface $input
* @param OutputInterface $output
*
* @return int|null
*/
public function __invoke(InputInterface $input, OutputInterface $output)
Expand Down
11 changes: 0 additions & 11 deletions src/LazyCommand.php
Expand Up @@ -21,14 +21,6 @@ final class LazyCommand extends Command
*/
private $serviceId;

/**
* @param ContainerInterface $container
* @param string $serviceId
* @param string $name
* @param array $definition
* @param string|null $description
* @param string|null $help
*/
public function __construct(
ContainerInterface $container,
string $serviceId,
Expand All @@ -48,9 +40,6 @@ public function __construct(
}

/**
* @param Input $input
* @param Output $output
*
* @return int|null
*/
protected function execute(Input $input, Output $output)
Expand Down
@@ -1,6 +1,8 @@
<?php

namespace Chubbyphp\Tests\Lazy;
declare(strict_types=1);

namespace Chubbyphp\Tests\Lazy\Unit;

use Chubbyphp\Lazy\CommandAdapter;
use PHPUnit\Framework\MockObject\MockObject;
Expand All @@ -11,16 +13,14 @@

/**
* @covers \Chubbyphp\Lazy\CommandAdapter
*
* @internal
*/
final class CommandAdapterTest extends TestCase
{
public function testExecute()
{
$command = new class('command:name') extends Command {
/**
* @param InputInterface $input
* @param OutputInterface $output
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$output->writeln($input->getArgument('name'));
Expand Down
16 changes: 5 additions & 11 deletions tests/LazyCommandTest.php → tests/Unit/LazyCommandTest.php
@@ -1,6 +1,8 @@
<?php

namespace Chubbyphp\Tests\Lazy;
declare(strict_types=1);

namespace Chubbyphp\Tests\Lazy\Unit;

use Chubbyphp\Lazy\LazyCommand;
use Interop\Container\ContainerInterface as InteropContainerInterface;
Expand All @@ -13,6 +15,8 @@

/**
* @covers \Chubbyphp\Lazy\LazyCommand
*
* @internal
*/
final class LazyCommandTest extends TestCase
{
Expand Down Expand Up @@ -74,11 +78,6 @@ public function testInvokePsr()
self::assertSame(5, $command->run($input, $output));
}

/**
* @param array $services
*
* @return InteropContainerInterface
*/
private function getInteroptContainer(array $services): InteropContainerInterface
{
/** @var InteropContainerInterface|MockObject $container */
Expand All @@ -95,11 +94,6 @@ private function getInteroptContainer(array $services): InteropContainerInterfac
return $container;
}

/**
* @param array $services
*
* @return PsrContainerInterface
*/
private function getPsrContainer(array $services): PsrContainerInterface
{
/** @var PsrContainerInterface|MockObject $container */
Expand Down
4 changes: 0 additions & 4 deletions tests/bootstrap.php

This file was deleted.

0 comments on commit 5d65def

Please sign in to comment.