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
3 changes: 2 additions & 1 deletion .scrutinizer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,15 @@ build:

environment:
variables:
XDEBUG_MODE: 'coverage'
CI: 'true'
TEST_OUTPUT_STYLE: 'pretty'
COMPOSER_OPTIONS: '--optimize-autoloader'
COVERAGE_OUTPUT_STYLE: 'clover'
COVERAGE_CLOVER_FILE_PATH: 'build/coverage/clover.xml'
PHPCS_DISABLE_WARNING: "true"
php:
version: "7.1"
version: "8.2"
timezone: UTC
postgresql: false
redis: false
Expand Down
13 changes: 10 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,21 @@
"yoanm/symfony-jsonrpc-http-server": "JSON-RPC HTTP Symfony server Bundle"
},
"require": {
"php": ">=7.1",
"php": "^8.0",
"ext-json": "*"
},
"require-dev": {
"behat/behat": "~3.0",
"squizlabs/php_codesniffer": "3.*",
"phpunit/phpunit": "^7.0 || ^8.0",
"phpunit/phpunit": "^9.6",
"yoanm/php-unit-extended": "^1.0",
"yoanm/jsonrpc-server-doc-sdk": "^0.2"
"yoanm/jsonrpc-server-doc-sdk": "^0.2",
"phpspec/prophecy": "^1.17",
"phpspec/prophecy-phpunit": "^2.0"
},
"config": {
"allow-plugins": {
"phpstan/extension-installer": true
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@
namespace Tests\Functional\App\Creator\ResponseCreator;

use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;
use Yoanm\JsonRpcServer\App\Creator\ResponseCreator;
use Yoanm\JsonRpcServer\Domain\Model\JsonRpcRequest;
use Yoanm\JsonRpcServer\Domain\Model\JsonRpcResponse;

class BaseTestCase extends TestCase
{
use ProphecyTrait;

const DEFAULT_JSONRPC = '2.0';
const DEFAULT_ID = '1234567890';
const DEFAULT_METHOD = 'defaultMethod';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<?php
namespace Tests\Functional\App\Creator\ResponseCreator;

use Prophecy\PhpUnit\ProphecyTrait;

/**
* @covers \Yoanm\JsonRpcServer\App\Creator\ResponseCreator
*
Expand All @@ -11,6 +13,8 @@
*/
class CreateEmptyResponseTest extends BaseTestCase
{
use ProphecyTrait;

/**
* Should bind following properties to response :
* - json-rpc version from request
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php
namespace Tests\Functional\App\Creator\ResponseCreator;

use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ObjectProphecy;
use Yoanm\JsonRpcServer\Domain\Exception\JsonRpcException;

Expand All @@ -11,6 +12,8 @@
*/
class CreateErrorResponseTest extends BaseTestCase
{
use ProphecyTrait;

/**
* Should handle error
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
<?php
namespace Tests\Functional\App\Creator\ResponseCreator;

use Prophecy\PhpUnit\ProphecyTrait;

/**
* @covers \Yoanm\JsonRpcServer\App\Creator\ResponseCreator
*
* @group ResponseCreator
*/
class CreateResultResponseTest extends BaseTestCase
{
use ProphecyTrait;

/**
* Should handle result
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
namespace Tests\Functional\App\Dispatcher;

use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ObjectProphecy;
use Yoanm\JsonRpcServer\App\Dispatcher\JsonRpcServerDispatcherAwareTrait;
use Yoanm\JsonRpcServer\Domain\Event\JsonRpcServerEvent;
Expand All @@ -14,6 +15,8 @@
*/
class JsonRpcServerDispatcherAwareTraitTest extends TestCase
{
use ProphecyTrait;

/** @var JsonRpcServerDispatcherAwareTrait|ConcreteDispatcherAware */
private $dispatcherAware;
/** @var JsonRpcServerDispatcherInterface|ObjectProphecy */
Expand Down
3 changes: 3 additions & 0 deletions tests/Functional/App/Handler/ExceptionHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
namespace Tests\Functional\App\Handler;

use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ObjectProphecy;
use Yoanm\JsonRpcServer\App\Creator\ResponseCreator;
use Yoanm\JsonRpcServer\App\Handler\ExceptionHandler;
Expand All @@ -15,6 +16,8 @@
*/
class ExceptionHandlerTest extends TestCase
{
use ProphecyTrait;

/** @var ExceptionHandler */
private $exceptionHandler;
/** @var ResponseCreator */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

use PHPUnit\Framework\TestCase;
use Prophecy\Argument;
use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ObjectProphecy;
use Yoanm\JsonRpcServer\App\Creator\ResponseCreator;
use Yoanm\JsonRpcServer\App\Handler\ExceptionHandler;
Expand All @@ -18,6 +19,8 @@
*/
class ExceptionHandlerWithDispatcherTest extends TestCase
{
use ProphecyTrait;

/** @var ExceptionHandler */
private $exceptionHandler;
/** @var ResponseCreator|ObjectProphecy */
Expand Down
3 changes: 3 additions & 0 deletions tests/Functional/App/Handler/JsonRpcRequestHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

use PHPUnit\Framework\TestCase;
use Prophecy\Argument;
use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ObjectProphecy;
use Yoanm\JsonRpcServer\App\Creator\ResponseCreator;
use Yoanm\JsonRpcServer\App\Handler\JsonRpcRequestHandler;
Expand All @@ -19,6 +20,8 @@
*/
class JsonRpcRequestHandlerTest extends TestCase
{
use ProphecyTrait;

/** @var JsonRpcRequestHandler */
private $requestHandler;
/** @var JsonRpcMethodResolverInterface|ObjectProphecy */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

use PHPUnit\Framework\TestCase;
use Prophecy\Argument;
use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ObjectProphecy;
use Yoanm\JsonRpcServer\App\Creator\ResponseCreator;
use Yoanm\JsonRpcServer\App\Handler\JsonRpcRequestHandler;
Expand All @@ -20,6 +21,8 @@
*/
class JsonRpcRequestHandlerWithDispatcherTest extends TestCase
{
use ProphecyTrait;

/** @var JsonRpcRequestHandler */
private $requestHandler;
/** @var JsonRpcMethodResolverInterface|ObjectProphecy */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

use PHPUnit\Framework\TestCase;
use Prophecy\Argument;
use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ObjectProphecy;
use Tests\Functional\App\Serialization\Helper\DenormalizationValidatorTrait;
use Tests\Functional\App\Serialization\Helper\RequestStringProviderTrait;
Expand All @@ -18,6 +19,8 @@
*/
class JsonRpcCallDenormalizerTest extends TestCase
{
use ProphecyTrait;

use DenormalizationValidatorTrait;
use RequestStringProviderTrait;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
namespace Tests\Functional\App\Serialization;

use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ObjectProphecy;
use Tests\Functional\App\Serialization\Helper\JsonRpcCallResponseProviderTrait;
use Tests\Functional\App\Serialization\Helper\NormalizationHelperTrait;
Expand All @@ -17,6 +18,8 @@
*/
class JsonRpcCallResponseNormalizerTest extends TestCase
{
use ProphecyTrait;

use JsonRpcCallResponseProviderTrait;
use NormalizationHelperTrait;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
namespace Tests\Functional\App\Serialization\JsonRpcCallSerializer;

use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ObjectProphecy;
use Tests\Functional\App\Serialization\Helper\RequestStringProviderTrait;
use Yoanm\JsonRpcServer\App\Serialization\JsonRpcCallDenormalizer;
Expand All @@ -18,6 +19,8 @@
*/
class DecodeTest extends TestCase
{
use ProphecyTrait;

use RequestStringProviderTrait;

/** @var JsonRpcCallSerializer */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

use PHPUnit\Framework\TestCase;
use Prophecy\Argument;
use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ObjectProphecy;
use Tests\Functional\App\Serialization\Helper\RequestStringProviderTrait;
use Yoanm\JsonRpcServer\App\Serialization\JsonRpcCallDenormalizer;
Expand All @@ -18,6 +19,8 @@
*/
class DenormalizeTest extends TestCase
{
use ProphecyTrait;

use RequestStringProviderTrait;

/** @var JsonRpcCallSerializer */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

use PHPUnit\Framework\TestCase;
use Prophecy\Argument;
use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ObjectProphecy;
use Tests\Functional\App\Serialization\Helper\RequestStringProviderTrait;
use Yoanm\JsonRpcServer\App\Serialization\JsonRpcCallDenormalizer;
Expand All @@ -18,6 +19,8 @@
*/
class DeserializeTest extends TestCase
{
use ProphecyTrait;

use RequestStringProviderTrait;

/** @var JsonRpcCallSerializer */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
namespace Tests\Functional\App\Serialization\JsonRpcCallSerializer;

use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ObjectProphecy;
use Yoanm\JsonRpcServer\App\Serialization\JsonRpcCallDenormalizer;
use Yoanm\JsonRpcServer\App\Serialization\JsonRpcCallResponseNormalizer;
Expand All @@ -15,6 +16,8 @@
*/
class EncodeTest extends TestCase
{
use ProphecyTrait;

/** @var JsonRpcCallSerializer */
private $jsonRpcCallSerializer;
/** @var JsonRpcCallDenormalizer|ObjectProphecy */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
namespace Tests\Functional\App\Serialization\JsonRpcCallSerializer;

use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ObjectProphecy;
use Tests\Functional\App\Serialization\Helper\JsonRpcCallResponseProviderTrait;
use Yoanm\JsonRpcServer\App\Serialization\JsonRpcCallDenormalizer;
Expand All @@ -17,6 +18,8 @@
*/
class NormalizeTest extends TestCase
{
use ProphecyTrait;

use JsonRpcCallResponseProviderTrait;

/** @var JsonRpcCallSerializer */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
namespace Tests\Functional\App\Serialization\JsonRpcCallSerializer;

use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ObjectProphecy;
use Tests\Functional\App\Serialization\Helper\JsonRpcCallResponseProviderTrait;
use Yoanm\JsonRpcServer\App\Serialization\JsonRpcCallDenormalizer;
Expand All @@ -17,6 +18,8 @@
*/
class SerializeTest extends TestCase
{
use ProphecyTrait;

use JsonRpcCallResponseProviderTrait;

/** @var JsonRpcCallSerializer */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
namespace Tests\Functional\App\Serialization;

use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;
use Yoanm\JsonRpcServer\App\Serialization\JsonRpcRequestDenormalizer;
use Yoanm\JsonRpcServer\Domain\Exception\JsonRpcInvalidRequestException;

Expand All @@ -13,6 +14,8 @@
*/
class JsonRpcRequestDenormalizerTest extends TestCase
{
use ProphecyTrait;

/** @var JsonRpcRequestDenormalizer */
private $requestDenormalizer;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
namespace Tests\Functional\App\Serialization;

use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;
use Yoanm\JsonRpcServer\App\Serialization\JsonRpcResponseNormalizer;
use Yoanm\JsonRpcServer\Domain\Exception\JsonRpcException;
use Yoanm\JsonRpcServer\Domain\Model\JsonRpcResponse;
Expand All @@ -14,6 +15,8 @@
*/
class JsonRpcResponseNormalizerTest extends TestCase
{
use ProphecyTrait;

const EXPECTED_KEY_JSONRPC_VERSION = 'jsonrpc';
const EXPECTED_KEY_ID = 'id';
const EXPECTED_KEY_RESULT = 'result';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
namespace Tests\Functional\Domain\Event\Acknowledge;

use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;
use Yoanm\JsonRpcServer\Domain\Event\Acknowledge\OnBatchSubRequestProcessedEvent;

/**
Expand All @@ -13,6 +14,8 @@
*/
class OnBatchSubRequestProcessedEventTest extends TestCase
{
use ProphecyTrait;

public function testShouldManageAnItemPosition()
{
$itemPosition = 23;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
namespace Tests\Functional\Domain\Event\Acknowledge;

use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;
use Yoanm\JsonRpcServer\Domain\Event\Acknowledge\OnBatchSubRequestProcessingEvent;

/**
Expand All @@ -13,6 +14,8 @@
*/
class OnBatchSubRequestProcessingEventTest extends TestCase
{
use ProphecyTrait;

public function testShouldManageAnItemPosition()
{
$itemPosition = 23;
Expand Down
Loading