Skip to content
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
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
branches:
- "*.x"
pull_request:
workflow_dispatch:

env:
DEPENDENCIES: 'toflar/psr6-symfony-http-cache-store:^2|^3|^4'
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/spellcheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
branches:
- "*.x"
pull_request:
workflow_dispatch:

jobs:
build:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
branches:
- "*.x"
pull_request:
workflow_dispatch:

jobs:
phpstan-src:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
vendor/
composer.lock
phpunit.xml
phpstan.neon
doc/_build/
.php-cs-fixer.cache
puli.json
Expand Down
4 changes: 2 additions & 2 deletions tests/Functional/Symfony/EventDispatchingHttpCacheTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ public function testEventListeners(): void
->shouldReceive('handle')
->andReturn($expectedResponse)
->getMock();
// https://github.com/phpstan/phpstan-mockery/issues/8
/** @phpstan-ignore-next-line */
$store = \Mockery::mock(StoreInterface::class)
->shouldReceive('lookup')->andReturn(null)->times(1)
// https://github.com/phpstan/phpstan-mockery/issues/8
/* @phpstan-ignore-next-line */
->shouldReceive('write')->times(1)
->shouldReceive('unlock')->times(1)
// need to declare the cleanup function explicitly to avoid issue between register_shutdown_function and mockery
Expand Down
4 changes: 1 addition & 3 deletions tests/Functional/Varnish/UserContextFailureTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ class UserContextFailureTest extends VarnishTestCase
public function setUp(): void
{
// needs to be decided before doing the setup
// phpunit 9 calls the method getName(), phpunit 10 name()
$name = method_exists($this, 'name') ? $this->name() : $this->getName(); /* @phpstan-ignore-line */
$this->mode = 'testHashRequestFailure' === $name ? 'failure' : 'cache';
$this->mode = 'testHashRequestFailure' === $this->name() ? 'failure' : 'cache';

parent::setUp();
}
Expand Down
16 changes: 8 additions & 8 deletions tests/Unit/CacheInvalidatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,10 @@ public function testSupportsInvalid(): void
public function testInvalidatePath(): void
{
/** @var MockInterface&PurgeCapable $purge */
// https://github.com/phpstan/phpstan-mockery/issues/8
/** @phpstan-ignore-next-line */
$purge = \Mockery::mock(PurgeCapable::class)
->shouldReceive('purge')->once()->with('/my/route', [])
// https://github.com/phpstan/phpstan-mockery/issues/8
/* @phpstan-ignore-next-line */
->shouldReceive('purge')->once()->with('/my/route', ['X-Test-Header' => 'xyz'])
->shouldReceive('flush')->once()
->getMock();
Expand All @@ -99,10 +99,10 @@ public function testRefreshPath(): void
{
$headers = ['X' => 'Y'];
/** @var MockInterface&RefreshCapable $refresh */
// https://github.com/phpstan/phpstan-mockery/issues/8
/** @phpstan-ignore-next-line */
$refresh = \Mockery::mock(RefreshCapable::class)
->shouldReceive('refresh')->once()->with('/my/route', $headers)
// https://github.com/phpstan/phpstan-mockery/issues/8
/* @phpstan-ignore-next-line */
->shouldReceive('flush')->never()
->getMock();

Expand Down Expand Up @@ -194,10 +194,10 @@ public function testProxyClientExceptionsAreLogged(): void

$unreachableException = ProxyUnreachableException::proxyUnreachable($clientException);

// https://github.com/phpstan/phpstan-mockery/issues/8
/** @phpstan-ignore-next-line */
$response = \Mockery::mock(ResponseInterface::class)
->shouldReceive('getStatusCode')->andReturn(403)
// https://github.com/phpstan/phpstan-mockery/issues/8
/* @phpstan-ignore-next-line */
->shouldReceive('getReasonPhrase')->andReturn('Forbidden')
->getMock();
$responseException = ProxyResponseException::proxyResponse(new HttpException('test', $failedRequest, $response));
Expand All @@ -212,15 +212,15 @@ public function testProxyClientExceptionsAreLogged(): void

$cacheInvalidator = new CacheInvalidator($proxyClient);

// https://github.com/phpstan/phpstan-mockery/issues/8
/** @phpstan-ignore-next-line */
$logger = \Mockery::mock(LoggerInterface::class)
->shouldReceive('log')->once()
->with(
'critical',
'Request to caching proxy at 127.0.0.1 failed with message "Couldn\'t connect to host"',
['exception' => $unreachableException]
)
// https://github.com/phpstan/phpstan-mockery/issues/8
/* @phpstan-ignore-next-line */
->shouldReceive('log')->once()
->with(
'critical',
Expand Down
12 changes: 6 additions & 6 deletions tests/Unit/ResponseTaggerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ public function testGetTagsHeaderValue(): void

public function testTagResponseReplace(): void
{
// https://github.com/phpstan/phpstan-mockery/issues/8
/** @phpstan-ignore-next-line */
$headerFormatter = \Mockery::mock(TagHeaderFormatter::class)
->shouldReceive('getTagsHeaderValue')
->with(['tag-1', 'tag-2'])
->once()
->andReturn('tag-1,tag-2')
// https://github.com/phpstan/phpstan-mockery/issues/8
/* @phpstan-ignore-next-line */
->shouldReceive('getTagsHeaderName')
->once()
->andReturn('FOS-Tags')
Expand All @@ -75,13 +75,13 @@ public function testTagResponseReplace(): void

public function testTagResponseAdd(): void
{
// https://github.com/phpstan/phpstan-mockery/issues/8
/** @phpstan-ignore-next-line */
$headerFormatter = \Mockery::mock(TagHeaderFormatter::class)
->shouldReceive('getTagsHeaderValue')
->with(['tag-1', 'tag-2'])
->once()
->andReturn('tag-1,tag-2')
// https://github.com/phpstan/phpstan-mockery/issues/8
/* @phpstan-ignore-next-line */
->shouldReceive('getTagsHeaderName')
->once()
->andReturn('FOS-Tags')
Expand Down Expand Up @@ -109,10 +109,10 @@ public function testTagResponseNoTags(): void

$tagger = new ResponseTagger(['header_formatter' => $headerFormatter]);

// https://github.com/phpstan/phpstan-mockery/issues/8
/** @phpstan-ignore-next-line */
$response = \Mockery::mock(ResponseInterface::class)
->shouldReceive('withHeader')->never()
// https://github.com/phpstan/phpstan-mockery/issues/8
/* @phpstan-ignore-next-line */
->shouldReceive('withAddedHeader')->never()
->getMock();

Expand Down
8 changes: 4 additions & 4 deletions tests/Unit/Test/PHPUnit/IsCacheHitConstraintTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ public function setUp(): void

public function testMatches(): void
{
// https://github.com/phpstan/phpstan-mockery/issues/8
/** @phpstan-ignore-next-line */
$response = $this->getResponseMock()
->shouldReceive('hasHeader')->with('cache-header')->andReturn(true)
// https://github.com/phpstan/phpstan-mockery/issues/8
/* @phpstan-ignore-next-line */
->shouldReceive('getHeaderLine')->with('cache-header')->once()->andReturn('MISS')
->shouldReceive('getStatusCode')->andReturn(500)
->shouldReceive('getHeaders')->andReturn([])
Expand All @@ -46,10 +46,10 @@ public function testMatchesThrowsExceptionIfHeaderIsMissing(): void
$this->expectException(\RuntimeException::class);
$this->expectExceptionMessage('Response has no "cache-header" header');

// https://github.com/phpstan/phpstan-mockery/issues/8
/** @phpstan-ignore-next-line */
$response = $this->getResponseMock()
->shouldReceive('hasHeader')->with('cache-header')->once()->andReturn(false)
// https://github.com/phpstan/phpstan-mockery/issues/8
/* @phpstan-ignore-next-line */
->shouldReceive('getStatusCode')->andReturn(200)
->shouldReceive('getHeaders')->andReturn([])
->shouldReceive('getBody')->andReturn(new Stream(fopen('php://temp', 'r+')))
Expand Down
4 changes: 2 additions & 2 deletions tests/Unit/Test/PHPUnit/IsCacheMissConstraintTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ public function setUp(): void

public function testMatches(): void
{
// https://github.com/phpstan/phpstan-mockery/issues/8
/** @phpstan-ignore-next-line */
$response = $this->getResponseMock()
->shouldReceive('hasHeader')->with('cache-header')->andReturn(true)
// https://github.com/phpstan/phpstan-mockery/issues/8
/* @phpstan-ignore-next-line */
->shouldReceive('getHeaderLine')->with('cache-header')->once()->andReturn('HIT')
->shouldReceive('getStatusCode')->andReturn(200)
->getMock();
Expand Down
Loading