Skip to content

Commit

Permalink
CS
Browse files Browse the repository at this point in the history
  • Loading branch information
andrerom committed Jul 29, 2019
1 parent 3e51625 commit 919c20b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
11 changes: 5 additions & 6 deletions src/ProxyClient/Fastly.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function invalidateTags(array $tags)
{
$headers = [
'Fastly-Key' => $this->options['authentication_token'],
'Accept' => 'application/json'
'Accept' => 'application/json',
];

if (true === $this->options['soft_purge']) {
Expand All @@ -47,7 +47,7 @@ public function invalidateTags(array $tags)
foreach (\array_chunk($tags, 256) as $tagChunk) {
$this->queueRequest(
Request::METHOD_POST,
sprintf("/service/%s/purge", $this->options['service_identifier']),
sprintf('/service/%s/purge', $this->options['service_identifier']),
$headers + [
// TODO: change to use json payload if queueRequest is changed to expose possibility to pass body
'Surrogate-Key' => implode(' ', $tagChunk),
Expand Down Expand Up @@ -96,12 +96,12 @@ public function clear()
{
$headers = [
'Fastly-Key' => $this->options['authentication_token'],
'Accept' => 'application/json'
'Accept' => 'application/json',
];

$this->queueRequest(
Request::METHOD_POST,
sprintf("/service/%s/purge_all", $this->options['service_identifier']),
sprintf('/service/%s/purge_all', $this->options['service_identifier']),
$headers,
false
);
Expand All @@ -119,7 +119,7 @@ protected function configureOptions()
$resolver->setRequired([
'authentication_token',
'service_identifier',
'soft_purge'
'soft_purge',
]);

$resolver->setDefaults([
Expand All @@ -128,5 +128,4 @@ protected function configureOptions()

return $resolver;
}

}
8 changes: 3 additions & 5 deletions tests/Unit/ProxyClient/FastlyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@

namespace FOS\HttpCache\Tests\Unit\ProxyClient;

use FOS\HttpCache\ProxyClient\HttpDispatcher;
use FOS\HttpCache\ProxyClient\Fastly;
use FOS\HttpCache\ProxyClient\Symfony;
use FOS\HttpCache\ProxyClient\HttpDispatcher;
use Mockery\Adapter\Phpunit\MockeryPHPUnitIntegration;
use Mockery\MockInterface;
use PHPUnit\Framework\TestCase;
Expand Down Expand Up @@ -59,7 +58,6 @@ function (RequestInterface $request) {
$this->assertEquals('1', $request->getHeaderLine('Fastly-Soft-Purge'));
$this->assertEquals('post-1 post,type-3', $request->getHeaderLine('Surrogate-Key'));


return true;
}
), false
Expand Down Expand Up @@ -95,8 +93,8 @@ public function testInvalidateTags_HeadersSplit()
$this->httpDispatcher->shouldReceive('invalidate')->twice();

$tags = [];
for ($i = 1; $i < 258; $i++) {
$tags[] = 'post-' . $i;
for ($i = 1; $i < 258; ++$i) {
$tags[] = 'post-'.$i;
}
$fastly->invalidateTags($tags);
}
Expand Down

0 comments on commit 919c20b

Please sign in to comment.