Skip to content

Commit

Permalink
add atoum stubs
Browse files Browse the repository at this point in the history
  • Loading branch information
Jean-Beru committed Dec 30, 2022
1 parent 46f9325 commit 58c7f73
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 52 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ jobs:
phpstan-
continue-on-error: true
- name: Run PHPStan analysis
run: ./bin/phpstan analyse --no-interaction --no-progress --no-interaction --ansi
run: phpstan analyse --no-interaction --no-progress --no-interaction --ansi

atoum:
name: Atoum (PHP ${{ matrix.php }})
Expand Down
31 changes: 2 additions & 29 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,5 @@ parameters:
paths:
- src
- tests
bootstrapFiles:
- vendor/autoload.php

# inferPrivatePropertyTypeFromConstructor: true
# symfony:
# containerXmlPath: tests/Fixtures/app/var/cache/test/AppKernelTestDebugContainer.xml
# constantHassers: false
# doctrine:
# objectManagerLoader: tests/Fixtures/app/object-manager.php
# bootstrapFiles:
# - vendor/bin/.phpunit/phpunit/vendor/autoload.php
# # We're aliasing classes for phpunit in this file, it needs to be added here see phpstan/#2194
# - src/Symfony/Bundle/Test/Constraint/ArraySubset.php
# - tests/Fixtures/app/AppKernel.php
# excludePaths:
# # Symfony config
# - tests/Fixtures/app/config/config_swagger.php
# # Symfony cache
# - tests/Fixtures/app/var/
# - tests/Fixtures/Symfony/Maker
# # The Symfony Configuration API isn't good enough to be analysed
# - src/Symfony/Bundle/DependencyInjection/Configuration.php
# # Templates for Maker
# - src/Symfony/Maker/Resources/skeleton
# earlyTerminatingMethodCalls:
# PHPUnit\Framework\Constraint\Constraint:
# - fail
# ApiPlatform\Metadata\Resource\ResourceMetadataCollection:
# - handleNotFound
scanDirectories:
- vendor/atoum/stubs/classes
39 changes: 17 additions & 22 deletions tests/units/Context/JsonContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,26 @@

class JsonContext extends \atoum
{
/**
* @var HttpCallResultPool
*/
private $httpCallResultPool;
private HttpCallResultPool $httpCallResultPool;

public function beforeTestMethod($methodName): void
{
$this->mockGenerator->orphanize('__construct');
$httpCallResult = $this->newMockInstance(HttpCallResult::class);
$httpCallResult->getMockController()->getValue = json_encode([
'a string node' => 'some string',
'another string node' => 'some other string',
'a null node' => null,
'a true node' => true,
'a false node' => false,
'a number node' => 3,
'an array node' => [
'one',
'two',
'three',
],
]);

$this->httpCallResultPool = $this->newMockInstance(HttpCallResultPool::class);
$this->httpCallResultPool->getMockController()->getResult = $httpCallResult;
$this->httpCallResultPool = new HttpCallResultPool();
$this->httpCallResultPool->store(
new HttpCallResult(json_encode([
'a string node' => 'some string',
'another string node' => 'some other string',
'a null node' => null,
'a true node' => true,
'a false node' => false,
'a number node' => 3,
'an array node' => [
'one',
'two',
'three',
],
], \JSON_THROW_ON_ERROR))
);
}

public function testTheJsonNodeShouldBeEqualTo(): void
Expand Down

0 comments on commit 58c7f73

Please sign in to comment.