Skip to content

Commit

Permalink
Update v2.x-automation-test for micro/plugin-http-core
Browse files Browse the repository at this point in the history
  • Loading branch information
OleksiiBulba committed Jul 6, 2024
1 parent 0120116 commit 0fe974c
Show file tree
Hide file tree
Showing 28 changed files with 24 additions and 73 deletions.
3 changes: 0 additions & 3 deletions Business/Executor/RouteExecutorFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@ public function __construct(
) {
}

/**
* {@inheritDoc}
*/
public function create(): RouteExecutorInterface
{
return new RouteExecutor(
Expand Down
3 changes: 0 additions & 3 deletions Business/Generator/UrlGeneratorFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ public function __construct(
) {
}

/**
* {@inheritDoc}
*/
public function create(): UrlGeneratorInterface
{
return new UrlGenerator($this->routeCollectionFactory->create());
Expand Down
3 changes: 0 additions & 3 deletions Business/Matcher/Route/RouteMatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ public function __construct(
) {
}

/**
* {@inheritDoc}
*/
public function match(RouteInterface $route, Request $request): bool
{
foreach ($this->matchers as $matcher) {
Expand Down
3 changes: 0 additions & 3 deletions Business/Matcher/UrlMatcherFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ public function __construct(
) {
}

/**
* {@inheritDoc}
*/
public function create(): UrlMatcherInterface
{
return new UrlMatcher(
Expand Down
2 changes: 1 addition & 1 deletion Business/Response/Callback/ResponseCallback.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

namespace Micro\Plugin\HttpCore\Business\Response\Callback;

use Micro\Component\DependencyInjection\Autowire\AutowireHelperInterface;
use Micro\Framework\Autowire\AutowireHelperInterface;
use Micro\Plugin\HttpCore\Business\Route\RouteInterface;
use Micro\Plugin\HttpCore\Exception\RouteInvalidConfigurationException;

Expand Down
2 changes: 1 addition & 1 deletion Business/Response/Callback/ResponseCallbackFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

namespace Micro\Plugin\HttpCore\Business\Response\Callback;

use Micro\Component\DependencyInjection\Autowire\AutowireHelperFactoryInterface;
use Micro\Framework\Autowire\AutowireHelperFactoryInterface;
use Micro\Plugin\HttpCore\Business\Route\RouteInterface;

/**
Expand Down
3 changes: 0 additions & 3 deletions Business/Response/Transformer/ResponseTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ public function __construct(
) {
}

/**
* {@inheritDoc}
*/
public function transform(Request $request, Response $response, mixed &$responseData): bool
{
$transformed = false;
Expand Down
3 changes: 0 additions & 3 deletions Business/Route/Route.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@
/**
* @param array<class-string, string|null>|class-string|\Closure|object $controller
* @param array<string> $methods
* @param array|null $parameters
*
* @phpstan-ignore-next-line
*/
public function __construct(
private string $uri,
Expand Down
3 changes: 0 additions & 3 deletions Business/Route/RouteBuilderFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@
*/
readonly class RouteBuilderFactory implements RouteBuilderFactoryInterface
{
/**
* {@inheritDoc}
*/
public function create(): RouteBuilderInterface
{
return new RouteBuilder();
Expand Down
3 changes: 0 additions & 3 deletions Business/Route/RouteCollectionFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@ public function __construct(
$this->routeCollection = null;
}

/**
* {@inheritDoc}
*/
public function create(): RouteCollectionInterface
{
if ($this->routeCollection) {
Expand Down
3 changes: 0 additions & 3 deletions Facade/HttpFacade.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@ public function __construct(
) {
}

/**
* {@inheritDoc}
*/
public function createRouteBuilder(): RouteBuilderInterface
{
return $this->routeBuilderFactory->create();
Expand Down
3 changes: 0 additions & 3 deletions HttpCorePlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,6 @@ class HttpCorePlugin implements DependencyProviderInterface, ConfigurableInterfa

private Container $container;

/**
* {@inheritDoc}
*/
public function provideDependencies(Container $container): void
{
$this->container = $container;
Expand Down
3 changes: 0 additions & 3 deletions HttpCorePluginConfiguration.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ class HttpCorePluginConfiguration extends PluginConfiguration implements HttpCor
public const CFG_LOCATOR_TYPE_DEFAULT = 'code';
public const CFG_LOCATOR_TYPE = 'MICRO_HTTP_ROUTE_LOCATOR';

/**
* {@inheritDoc}
*/
public function getRouteLocatorType(): string
{
return $this->configuration->get(self::CFG_LOCATOR_TYPE, self::CFG_LOCATOR_TYPE_DEFAULT, false);
Expand Down
2 changes: 1 addition & 1 deletion Tests/Unit/Business/Executor/RouteExecutorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function testExecute(bool $isFlush, \Throwable|null $exception)
$this->assertInstanceOf(Response::class, $response);
}

public function dataProvider()
public static function dataProvider(): array
{
return [
[true, null],
Expand Down
2 changes: 1 addition & 1 deletion Tests/Unit/Business/Generator/UrlGeneratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function testGenerateUrlByRouteName(
$this->assertEquals($exceptedRoute, $generated);
}

public function dataProvider()
public static function dataProvider(): array
{
return [
['/test', [], [], '/test', null],
Expand Down
2 changes: 1 addition & 1 deletion Tests/Unit/Business/Locator/RouteLocatorFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ protected function createKernel(string $locatorAlias, bool $isLocatorNotFound):
return $stubKernel;
}

protected function dataProvider()
public static function dataProvider(): array
{
return [
['code', null],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,8 @@ class MethodMatcherTest extends TestCase
{
/**
* @dataProvider dataProvider
*
* @return void
*/
public function testMatch($routeMethod, $requestMethod)
public function testMatch($routeMethod, $requestMethod): void
{
$matcher = new MethodMatcher();

Expand Down Expand Up @@ -52,7 +50,7 @@ public function testMatch($routeMethod, $requestMethod)
);
}

public function dataProvider()
public static function dataProvider(): array
{
return [
['GET', 'GET'],
Expand Down
6 changes: 2 additions & 4 deletions Tests/Unit/Business/Matcher/Route/Matchers/UriMatcherTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,8 @@ class UriMatcherTest extends TestCase
{
/**
* @dataProvider dataProvider
*
* @return void
*/
public function testMatch(string $requestUri, string $routeUri, string|null $routePattern, bool $excepted, array|null $parameters)
public function testMatch(string $requestUri, string $routeUri, string|null $routePattern, bool $excepted, array|null $parameters): void
{
$matcher = new UriMatcher();

Expand Down Expand Up @@ -58,7 +56,7 @@ public function testMatch(string $requestUri, string $routeUri, string|null $rou
$this->assertEquals($excepted, $actual);
}

public function dataProvider()
public static function dataProvider(): array
{
return [
['/test/api.json', '/{first}/{second}.{_format}', '/\/(.[aA-zZ0-9_-]+)\/(.[aA-zZ0-9_-]+)\.(.[aA-zZ0-9_-]+)/', true, ['first', 'second', 'format']],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

class RouteMatcherFactoryTest extends TestCase
{
public function testCreate()
public function testCreate(): void
{
$factory = new RouteMatcherFactory();

Expand Down
6 changes: 2 additions & 4 deletions Tests/Unit/Business/Matcher/Route/RouteMatcherTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,8 @@ class RouteMatcherTest extends TestCase
{
/**
* @dataProvider dataProvider
*
* @return void
*/
public function testMatch(array $matchersResults, bool $exceptedResult)
public function testMatch(array $matchersResults, bool $exceptedResult): void
{
$route = $this->createMock(RouteInterface::class);
$request = $this->createMock(Request::class);
Expand All @@ -50,7 +48,7 @@ public function testMatch(array $matchersResults, bool $exceptedResult)
$this->assertEquals($exceptedResult, $result);
}

public function dataProvider()
public static function dataProvider(): array
{
return [
[
Expand Down
2 changes: 1 addition & 1 deletion Tests/Unit/Business/Matcher/UrlMatcherFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

class UrlMatcherFactoryTest extends TestCase
{
public function testCreate()
public function testCreate(): void
{
$factory = new UrlMatcherFactory(
$this->createMock(RouteCollectionFactoryInterface::class),
Expand Down
12 changes: 4 additions & 8 deletions Tests/Unit/Business/Matcher/UrlMatcherTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public function testMatch(
$this->assertEquals($routeName, $route->getName());
}

public function dataProvider()
public static function dataProvider(): array
{
return [
['test_dyn', 'GET', '/test/option_value/test_value.json', null],
Expand All @@ -77,21 +77,17 @@ public function dataProvider()
];
}

protected function createUrlMatcher()
protected function createUrlMatcher(): UrlMatcher
{
$urlMatcher = new UrlMatcher(
return new UrlMatcher(
$this->createRouteMatcher(),
$this->createRouteCollection(),
);

return $urlMatcher;
}

protected function createRouteMatcher(): RouteMatcherInterface
{
$matcher = (new RouteMatcherFactory())->create();

return $matcher;
return (new RouteMatcherFactory())->create();
}

protected function createRouteCollection(): RouteCollectionInterface
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

namespace Micro\Plugin\HttpCore\Tests\Unit\Business\Response;

use Micro\Component\DependencyInjection\Autowire\AutowireHelperFactoryInterface;
use Micro\Framework\Autowire\AutowireHelperFactoryInterface;
use Micro\Plugin\HttpCore\Business\Response\Callback\ResponseCallbackFactory;
use Micro\Plugin\HttpCore\Business\Response\Callback\ResponseCallbackInterface;
use Micro\Plugin\HttpCore\Business\Route\RouteInterface;
Expand Down
2 changes: 1 addition & 1 deletion Tests/Unit/Business/Response/ResponseCallbackTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

namespace Micro\Plugin\HttpCore\Tests\Unit\Business\Response;

use Micro\Component\DependencyInjection\Autowire\AutowireHelperInterface;
use Micro\Framework\Autowire\AutowireHelperInterface;
use Micro\Plugin\HttpCore\Business\Response\Callback\ResponseCallback;
use Micro\Plugin\HttpCore\Business\Route\RouteInterface;
use Micro\Plugin\HttpCore\Exception\RouteInvalidConfigurationException;
Expand Down
2 changes: 1 addition & 1 deletion Tests/Unit/Business/Route/RouteBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public function testBuild(
$this->assertEquals($routeName, $route->getName());
}

public function dataProvider()
public static function dataProvider(): array
{
return [
['test', function () {}, '/{test}.{_format}', '/\/(.[aA-zZ0-9-_]+)\.(.[aA-zZ0-9-_]+)$/', ['POST'], null],
Expand Down
2 changes: 1 addition & 1 deletion Tests/Unit/HttpCorePluginConfigurationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function testGetRouteLocatorType(string $configValue)
$this->assertEquals($configValue, $pluginConfiguration->getRouteLocatorType());
}

public function dataProvider()
public static function dataProvider(): array
{
return [
['code'], ['test'],
Expand Down
2 changes: 1 addition & 1 deletion Tests/Unit/HttpCorePluginTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function testPlugin(string $parameter)
$this->assertEquals($parameter, $response->getContent());
}

public function dataProvider()
public static function dataProvider(): array
{
return [
['success'],
Expand Down
10 changes: 2 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@
"micro/plugin-locator": "^2.0",
"symfony/http-foundation": "^6.2 || ^6.3"
},
"require-dev": {
"ergebnis/composer-normalize": "^2.34"
},
"minimum-stability": "dev",
"autoload": {
"psr-4": {
"Micro\\Plugin\\HttpCore\\": ""
Expand All @@ -30,10 +28,6 @@
]
},
"config": {
"allow-plugins": {
"ergebnis/composer-normalize": true
},
"sort-packages": true
},
"minimum-stability": "dev"
}
}

0 comments on commit 0fe974c

Please sign in to comment.