Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: drop PHP versions 7.1 and 7.2 #2

Merged
merged 1 commit into from
Apr 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,18 @@ jobs:
strategy:
matrix:
include:
- php: '7.2'
- php: '7.3'
symfony: '3.4.*'
- php: '7.4'
symfony: '3.4.*'
- php: '7.2'
- php: '7.3'
symfony: '4.4.*'
- php: '7.4'
symfony: '4.4.*'
- php: '7.2'
symfony: '5.1.*'
- php: '7.3'
symfony: '5.2.*'
- php: '7.4'
symfony: '5.1.*'
symfony: '5.2.*'
steps:
- name: checkout
uses: actions/checkout@v2
Expand Down Expand Up @@ -72,7 +72,7 @@ jobs:
symfony:
- '3.4.*'
- '4.4.*'
- '5.1.*'
- '5.2.*'
steps:
- name: checkout
uses: actions/checkout@v2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function __construct(HttpClient $client, TracingId $tracingId)
$this->tracingId = $tracingId;
}

protected function execute(InputInterface $input, OutputInterface $output)
protected function execute(InputInterface $input, OutputInterface $output): int
{
$request = new Request('GET', '/');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public function __construct(HttpClient $client)
$this->client = $client;
}

public function index(HttpClient $client)
public function index(HttpClient $client): JsonResponse
{
$request = new Request('GET', 'https://github.com/auxmoney/OpentracingBundle-HttplugBundle');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ class TestCommand extends Command
public function __construct(HttpClient $client, TracingId $tracingId)
{
parent::__construct('test:httplug');
$this->setDescription('some fancy command description');
$this->setDescription('some fancy command description');
$this->client = $client;
$this->tracingId = $tracingId;
}

protected function execute(InputInterface $input, OutputInterface $output)
protected function execute(InputInterface $input, OutputInterface $output): int
{
$request = new Request('GET', '/');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public function __construct(HttpClient $client)
$this->client = $client;
}

public function index(HttpClient $client)
public function index(HttpClient $client): JsonResponse
{
$request = new Request('GET', 'https://github.com/auxmoney/OpentracingBundle-HttplugBundle');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,29 @@

namespace Auxmoney\OpentracingHttplugBundle\Tests\Unit\DependencyInjection;

use Prophecy\Argument;
use PHPUnit\Framework\TestCase;
use Auxmoney\OpentracingHttplugBundle\DependencyInjection\HttplugPluginClientFactoryCompilerPass;
use Auxmoney\OpentracingHttplugBundle\Factory\DecoratedPluginClientFactory;
use Http\Client\Common\PluginClient;
use Http\Client\Common\PluginClientFactory;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\DependencyInjection\Definition;
use PHPUnit\Framework\TestCase;
use Prophecy\Argument;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Auxmoney\OpentracingHttplugBundle\Factory\DecoratedPluginClientFactory;
use Auxmoney\OpentracingHttplugBundle\DependencyInjection\HttplugPluginClientFactoryCompilerPass;
use Prophecy\Doubler\Generator\Node\ArgumentNode;
use Prophecy\Prophecy\ObjectProphecy;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Reference;

class HttplugPluginClientFactoryCompilerPassTest extends TestCase
{
/** @var HttplugPluginClientFactoryCompilerPass */
private $subject;

public function setUp()
public function setUp(): void
{
parent::setUp();

$this->subject = new HttplugPluginClientFactoryCompilerPass();
}
public function dataOfNonDesiredFactories()

public function dataOfNonDesiredFactories(): array
{
$factoryReferenceOkButWrongServiceId = $this->prophesize(Reference::class);
$factoryReferenceOkButWrongServiceId->__toString()->willReturn('wrongServiceId'); // here!
Expand All @@ -50,7 +48,7 @@ public function dataOfNonDesiredFactories()
]
];
}

/**
* @param string|array|null $factory
* @dataProvider dataOfNonDesiredFactories
Expand All @@ -62,7 +60,7 @@ public function testProcessDoesNothingWhenFactoryOfPluginClientDoesNotMatch($fac

$clientDefinition->getFactory()->willReturn($factory);
$clientDefinition->setFactory(Argument::any())->shouldNotBeCalled();

$container = new ContainerBuilder();
$container->addDefinitions([
'client' => $clientDefinition->reveal()
Expand All @@ -85,7 +83,7 @@ public function testProcessDoesNothingWhenFactoryOfPluginClientIsNotPluginClient
]);

$clientDefinition->setFactory(Argument::any())->shouldNotBeCalled();

$container = new ContainerBuilder();
$container->addDefinitions([
'client' => $clientDefinition->reveal()
Expand All @@ -98,10 +96,10 @@ public function testProcessDecoratesPluginClientFactory(): void
{
$clientDefinition = $this->prophesize(Definition::class);
$clientDefinition->getClass()->willReturn(PluginClient::class);

$clientFactory = $this->prophesize(Reference::class);
$clientFactory->__toString()->willReturn(PluginClientFactory::class);

$clientDefinition->getFactory()->willReturn([
$clientFactory->reveal(),
'factoryMethodOfPluginClientFactory'
Expand All @@ -111,7 +109,7 @@ public function testProcessDecoratesPluginClientFactory(): void
new Reference(DecoratedPluginClientFactory::class),
'createClient'
]))->shouldBeCalled();

$container = new ContainerBuilder();
$container->addDefinitions([
'client' => $clientDefinition->reveal()
Expand Down
22 changes: 11 additions & 11 deletions Tests/Unit/Plugin/OpentracingPluginTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@

namespace Auxmoney\OpentracingHttplugBundle\Tests\Unit\Plugin;

use Auxmoney\OpentracingBundle\Internal\Decorator\RequestSpanning;
use Auxmoney\OpentracingBundle\Service\Tracing;
use Auxmoney\OpentracingHttplugBundle\Plugin\OpentracingPlugin;
use Http\Client\Exception\HttpException;
use Http\Client\Exception\TransferException;
use Http\Client\Promise\HttpFulfilledPromise;
use Http\Client\Promise\HttpRejectedPromise;
use Nyholm\Psr7\Request;
use Nyholm\Psr7\Response;
use PHPUnit\Framework\TestCase;
use Prophecy\Prophecy\ObjectProphecy;
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\ResponseInterface;
use Http\Client\Exception\HttpException;
use Http\Client\Exception\TransferException;
use Http\Client\Promise\HttpRejectedPromise;
use Http\Client\Promise\HttpFulfilledPromise;
use Auxmoney\OpentracingBundle\Service\Tracing;
use Auxmoney\OpentracingHttplugBundle\Plugin\OpentracingPlugin;
use Auxmoney\OpentracingBundle\Internal\Decorator\RequestSpanning;

class OpentracingPluginTest extends TestCase
{
Expand All @@ -26,7 +26,7 @@ class OpentracingPluginTest extends TestCase
/** @var Tracing|ObjectProphecy */
private $tracing;

public function setUp()
public function setUp(): void
{
parent::setUp();
$this->requestSpanning = $this->prophesize(RequestSpanning::class);
Expand All @@ -50,7 +50,7 @@ public function test_invoke_fulfilled(): void
$subject = new OpentracingPlugin($this->requestSpanning->reveal(), $this->tracing->reveal());

$next = function (RequestInterface $request) use ($injectedRequest) {
$this->assertSame($request, $injectedRequest);
self::assertSame($request, $injectedRequest);
return new HttpFulfilledPromise(new Response(201, [], 'some body'));
};

Expand Down Expand Up @@ -88,7 +88,7 @@ public function test_when_promise_is_rejected_by_an_exception_its_logged_in_acti
$subject = new OpentracingPlugin($this->requestSpanning->reveal(), $this->tracing->reveal());

$next = function (RequestInterface $request) use ($injectedRequest, $exceptionToBeThrown) {
$this->assertSame($request, $injectedRequest);
self::assertSame($request, $injectedRequest);
return new HttpRejectedPromise($exceptionToBeThrown);
};

Expand Down Expand Up @@ -125,7 +125,7 @@ public function test_when_promise_is_rejected_by_exception_that_contains_respons
$subject = new OpentracingPlugin($this->requestSpanning->reveal(), $this->tracing->reveal());

$next = function (RequestInterface $request) use ($injectedRequest, $exceptionToBeThrown) {
$this->assertSame($request, $injectedRequest);
self::assertSame($request, $injectedRequest);
return new HttpRejectedPromise($exceptionToBeThrown);
};

Expand Down
16 changes: 8 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,23 @@
"type": "symfony-bundle",
"license": "MIT",
"require": {
"php": "^7.2.33",
"php": "^7.3.27",
"opentracing/opentracing": "1.0.0-beta5@beta",
"auxmoney/opentracing-bundle-core": "^v0.7.2",
"php-http/httplug-bundle": "^1.19"
"auxmoney/opentracing-bundle-core": "^v0.8",
"php-http/httplug-bundle": "^1.20"
},
"require-dev": {
"roave/security-advisories": "dev-master",
"phpunit/phpunit": "^7.5",
"phpstan/phpstan": "^0.12",
"squizlabs/php_codesniffer": "^3.5",
"phpmd/phpmd": "^2.7",
"php-coveralls/php-coveralls": "^2.2",
"squizlabs/php_codesniffer": "^3.6",
"phpmd/phpmd": "^2.9",
"php-coveralls/php-coveralls": "^2.4",
"symfony/filesystem": "*",
"symfony/process": "*",
"symfony/yaml": "*",
"mtdowling/jmespath.php": "^2.5",
"nyholm/psr7": "^1.3",
"mtdowling/jmespath.php": "^2.6",
"nyholm/psr7": "^1.4",
"php-http/curl-client": "^2.2"
},
"autoload": {
Expand Down