Skip to content

Commit

Permalink
fix: drop PHP versions 7.1 and 7.2 (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
cawolf authored Jun 25, 2021
1 parent 9408b74 commit b09285f
Show file tree
Hide file tree
Showing 19 changed files with 56 additions and 144 deletions.
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.1'
- 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
6 changes: 3 additions & 3 deletions Tests/Decorator/GuzzleClientFactoryDecoratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@

class GuzzleClientFactoryDecoratorTest extends TestCase
{
public function setUp()
public function setUp(): void
{
parent::setUp();
}

public function testdecorateClient(): void
public function testDecorateClient(): void
{
$client = $this->prophesize(Client::class);
$handlerStack = $this->prophesize(HandlerStack::class);
Expand All @@ -40,7 +40,7 @@ public function testdecorateClient(): void
self::assertSame($client->reveal(), $clientReturned);
}

public function testdecorateNoClient(): void
public function testDecorateNoClient(): void
{
$client = $this->prophesize(Client::class);
$requestSpanning = $this->prophesize(RequestSpanning::class);
Expand Down
36 changes: 4 additions & 32 deletions Tests/DependencyInjection/GuzzleHandlerStackCompilerPassTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,13 @@
use Prophecy\Argument;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
use Symfony\Component\DependencyInjection\Reference;

class GuzzleHandlerStackCompilerPassTest extends TestCase
{
/** @var GuzzleHandlerStackCompilerPass */
private $subject;

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

Expand All @@ -38,10 +36,7 @@ public function testProcessNoClientDefinitions(): void
$this->subject->process($container);
}

/**
* @dataProvider provideHandlerConfigWithoutHandler
*/
public function testProcessHandlerConfigWithoutHandler(?array $arguments): void
public function testProcessHandlerConfigWithoutHandler(): void
{
$noClientDefinition = $this->prophesize(Definition::class);
$noClientDefinition->getClass()->willReturn(Definition::class);
Expand All @@ -57,19 +52,7 @@ public function testProcessHandlerConfigWithoutHandler(?array $arguments): void
self::assertCount(4, $container->getDefinitions());
}

public function provideHandlerConfigWithoutHandler(): array
{
return [
['no config' => [[]]],
['config indexed by number' => [0 => ['verify' => false]]],
['config indexed by name' => ['$config' => ['verify' => false]]],
];
}

/**
* @dataProvider provideHandlerConfigWithHandler
*/
public function testProcessHandlerConfigWithHandler(?array $arguments): void
public function testProcessHandlerConfigWithHandler(): void
{
$noClientDefinition = $this->prophesize(Definition::class);
$noClientDefinition->getClass()->willReturn(Definition::class);
Expand All @@ -92,10 +75,7 @@ public function testProcessHandlerConfigWithHandler(?array $arguments): void
self::assertCount(5, $container->getDefinitions());
}

/**
* @dataProvider provideHandlerConfigWithHandler
*/
public function testProcessHandlerConfigWithHandlerMultipleClients(?array $arguments): void
public function testProcessHandlerConfigWithHandlerMultipleClients(): void
{
$noClientDefinition = $this->prophesize(Definition::class);
$noClientDefinition->getClass()->willReturn(Definition::class);
Expand All @@ -120,12 +100,4 @@ public function testProcessHandlerConfigWithHandlerMultipleClients(?array $argum

self::assertCount(7, $container->getDefinitions());
}

public function provideHandlerConfigWithHandler(): array
{
return [
['config indexed by number' => [0 => ['verify' => false, 'handler' => new Reference('handlerServiceName')]]],
['config indexed by name' => ['$config' => ['verify' => false, 'handler' => new Reference('handlerServiceName')]]],
];
}
}
2 changes: 1 addition & 1 deletion Tests/DependencyInjection/OpentracingExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class OpentracingExtensionTest extends TestCase
{
private $subject;

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

Expand Down
2 changes: 1 addition & 1 deletion Tests/Functional/FunctionalTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function testNestedSpansAndHeaderPropagation(string $projectSetup): void
$p = new Process(['symfony', 'console', 'test:guzzle'], 'build/testproject');
$p->mustRun();
$output = $p->getOutput();
$traceId = substr($output, 0, strpos($output, ':'));
$traceId = trim($p->getOutput());
self::assertNotEmpty($traceId);

$spans = $this->getSpansFromTrace($this->getTraceFromJaegerAPI($traceId));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,39 +4,36 @@

namespace App\Command;

use Auxmoney\OpentracingBundle\Internal\Opentracing;
use Auxmoney\OpentracingBundle\Internal\TracingId;
use GuzzleHttp\ClientInterface;
use GuzzleHttp\Exception\GuzzleException;
use GuzzleHttp\Psr7\Request;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use const OpenTracing\Formats\TEXT_MAP;

class TestCommand extends Command
{
private $client;
private $opentracing;
private $tracingId;

public function __construct(ClientInterface $client, Opentracing $opentracing)
public function __construct(ClientInterface $client, TracingId $tracingId)
{
parent::__construct('test:guzzle');
$this->setDescription('some fancy command description');
$this->client = $client;
$this->opentracing = $opentracing;
$this->tracingId = $tracingId;
}

/**
* @throws GuzzleException
*/
protected function execute(InputInterface $input, OutputInterface $output)
protected function execute(InputInterface $input, OutputInterface $output): int
{
$request = new Request('GET', '/');
$this->client->send($request)->getBody()->getContents();

$carrier = [];
$this->opentracing->getTracerInstance()->inject($this->opentracing->getTracerInstance()->getActiveSpan()->getContext(), TEXT_MAP, $carrier);
$output->writeln(current($carrier));
$output->writeln($this->tracingId->getAsString());
return 0;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ class TestController extends AbstractController
/**
* @throws GuzzleException
*/
public function index(ClientInterface $client) {
public function index(ClientInterface $client): JsonResponse
{
$request = new Request('GET', 'https://github.com/auxmoney/OpentracingBundle-Guzzle');
$contents = $client->send($request)->getBody()->getContents();
return new JsonResponse(['nested' => true, 'contentsLength' => strlen($contents)]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,8 @@

namespace App\Service;

use Psr\Http\Message\RequestInterface;
use GuzzleHttp\Handler\CurlHandler;

class TestHandler
class TestHandler extends CurlHandler
{
public function __invoke()
{
$header = 'a';
$value = 'b';
return function (
RequestInterface $request
) use ($header, $value) {
return $request->withHeader($header, $value);
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,39 +4,36 @@

namespace App\Command;

use Auxmoney\OpentracingBundle\Internal\Opentracing;
use Auxmoney\OpentracingBundle\Internal\TracingId;
use GuzzleHttp\ClientInterface;
use GuzzleHttp\Exception\GuzzleException;
use GuzzleHttp\Psr7\Request;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use const OpenTracing\Formats\TEXT_MAP;

class TestCommand extends Command
{
private $client;
private $opentracing;
private $tracingId;

public function __construct(ClientInterface $client, Opentracing $opentracing)
public function __construct(ClientInterface $client, TracingId $tracingId)
{
parent::__construct('test:guzzle');
$this->setDescription('some fancy command description');
$this->client = $client;
$this->opentracing = $opentracing;
$this->tracingId = $tracingId;
}

/**
* @throws GuzzleException
*/
protected function execute(InputInterface $input, OutputInterface $output)
protected function execute(InputInterface $input, OutputInterface $output): int
{
$request = new Request('GET', '/');
$this->client->send($request)->getBody()->getContents();

$carrier = [];
$this->opentracing->getTracerInstance()->inject($this->opentracing->getTracerInstance()->getActiveSpan()->getContext(), TEXT_MAP, $carrier);
$output->writeln(current($carrier));
$output->writeln($this->tracingId->getAsString());
return 0;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ class TestController extends AbstractController
/**
* @throws GuzzleException
*/
public function index(ClientInterface $client) {
public function index(ClientInterface $client): JsonResponse
{
$request = new Request('GET', 'https://github.com/auxmoney/OpentracingBundle-Guzzle');
$contents = $client->send($request)->getBody()->getContents();
return new JsonResponse(['nested' => true, 'contentsLength' => strlen($contents)]);
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,39 +4,36 @@

namespace App\Command;

use Auxmoney\OpentracingBundle\Internal\Opentracing;
use Auxmoney\OpentracingBundle\Internal\TracingId;
use GuzzleHttp\ClientInterface;
use GuzzleHttp\Exception\GuzzleException;
use GuzzleHttp\Psr7\Request;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use const OpenTracing\Formats\TEXT_MAP;

class TestCommand extends Command
{
private $client;
private $opentracing;
private $tracingId;

public function __construct(ClientInterface $client, Opentracing $opentracing)
public function __construct(ClientInterface $client, TracingId $tracingId)
{
parent::__construct('test:guzzle');
$this->setDescription('some fancy command description');
$this->client = $client;
$this->opentracing = $opentracing;
$this->tracingId = $tracingId;
}

/**
* @throws GuzzleException
*/
protected function execute(InputInterface $input, OutputInterface $output)
protected function execute(InputInterface $input, OutputInterface $output): int
{
$request = new Request('GET', '/');
$this->client->send($request)->getBody()->getContents();

$carrier = [];
$this->opentracing->getTracerInstance()->inject($this->opentracing->getTracerInstance()->getActiveSpan()->getContext(), TEXT_MAP, $carrier);
$output->writeln(current($carrier));
$output->writeln($this->tracingId->getAsString());
return 0;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ class TestController extends AbstractController
/**
* @throws GuzzleException
*/
public function index(ClientInterface $client) {
public function index(ClientInterface $client): JsonResponse
{
$request = new Request('GET', 'https://github.com/auxmoney/OpentracingBundle-Guzzle');
$contents = $client->send($request)->getBody()->getContents();
return new JsonResponse(['nested' => true, 'contentsLength' => strlen($contents)]);
Expand Down

This file was deleted.

Loading

0 comments on commit b09285f

Please sign in to comment.