Skip to content

Commit 72aaa48

Browse files
committed
Fixed basebundle dep
1 parent 78280f6 commit 72aaa48

12 files changed

+792
-2358
lines changed

.circleci/config.yml

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,20 @@ jobs:
77
working_directory: ~/project
88
steps:
99
- checkout
10+
11+
- run:
12+
name: Install PHPUnit
13+
command: |
14+
composer require phpunit/phpunit:7.*
15+
16+
- run:
17+
name: Run tests / Symfony 4^3
18+
command: |
19+
composer update -n --prefer-dist --prefer-stable --no-suggest
20+
php vendor/bin/phpunit
21+
1022
- run:
11-
name: Run tests
23+
name: Run tests / Symfony 5^0
1224
command: |
13-
composer install -n --prefer-dist --no-suggest
14-
composer test
25+
composer update -n --prefer-dist --no-suggest
26+
php vendor/bin/phpunit

.php_cs.cache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"php":"7.3.9-1+ubuntu18.04.1+deb.sury.org+1","version":"2.16.0:v2.16.0#ceaff36bee1ed3f1bbbedca36d2528c0826c336d","indent":" ","lineEnding":"\n","rules":{"blank_line_after_namespace":true,"braces":{"allow_single_line_closure":true},"class_definition":{"single_line":true},"constant_case":true,"elseif":true,"function_declaration":true,"indentation_type":true,"line_ending":true,"lowercase_keywords":true,"method_argument_space":true,"no_break_comment":true,"no_closing_tag":true,"no_spaces_after_function_name":true,"no_spaces_inside_parenthesis":true,"no_trailing_whitespace":true,"no_trailing_whitespace_in_comment":true,"single_blank_line_at_eof":true,"single_class_element_per_statement":true,"single_import_per_statement":true,"single_line_after_imports":true,"switch_case_semicolon_to_colon":true,"switch_case_space":true,"visibility_required":true,"encoding":true,"full_opening_tag":true,"array_syntax":{"syntax":"short"},"binary_operator_spaces":true,"blank_line_after_opening_tag":true,"blank_line_before_statement":{"statements":["return"]},"cast_spaces":true,"class_attributes_separation":{"elements":["method"]},"concat_space":true,"declare_equal_normalize":true,"function_typehint_space":true,"include":true,"increment_style":true,"lowercase_cast":true,"lowercase_static_reference":true,"magic_constant_casing":true,"magic_method_casing":true,"native_function_casing":true,"native_function_type_declaration_casing":true,"new_with_braces":true,"no_blank_lines_after_class_opening":true,"no_blank_lines_after_phpdoc":true,"no_empty_comment":true,"no_empty_phpdoc":true,"no_empty_statement":true,"no_extra_blank_lines":{"tokens":["curly_brace_block","extra","parenthesis_brace_block","square_brace_block","throw","use"]},"no_leading_import_slash":true,"no_leading_namespace_whitespace":true,"no_mixed_echo_print":true,"no_multiline_whitespace_around_double_arrow":true,"no_short_bool_cast":true,"no_singleline_whitespace_before_semicolons":true,"no_spaces_around_offset":true,"no_superfluous_phpdoc_tags":{"allow_mixed":true,"allow_unused_params":true},"no_trailing_comma_in_list_call":true,"no_trailing_comma_in_singleline_array":true,"no_unneeded_control_parentheses":true,"no_unneeded_curly_braces":true,"no_unneeded_final_method":true,"no_unused_imports":true,"no_whitespace_before_comma_in_array":true,"no_whitespace_in_blank_line":true,"normalize_index_brace":true,"object_operator_without_whitespace":true,"ordered_imports":true,"php_unit_fqcn_annotation":true,"phpdoc_align":{"tags":["method","param","property","return","throws","type","var"]},"phpdoc_annotation_without_dot":true,"phpdoc_indent":true,"phpdoc_inline_tag":true,"phpdoc_no_access":true,"phpdoc_no_alias_tag":true,"phpdoc_no_package":true,"phpdoc_no_useless_inheritdoc":true,"phpdoc_return_self_reference":true,"phpdoc_scalar":true,"phpdoc_separation":true,"phpdoc_single_line_var_spacing":true,"phpdoc_summary":true,"phpdoc_to_comment":true,"phpdoc_trim":true,"phpdoc_trim_consecutive_blank_line_separation":true,"phpdoc_types":true,"phpdoc_types_order":{"null_adjustment":"always_last","sort_algorithm":"none"},"phpdoc_var_without_name":true,"return_type_declaration":true,"semicolon_after_instruction":true,"short_scalar_cast":true,"single_blank_line_before_namespace":true,"single_line_comment_style":{"comment_types":["hash"]},"single_line_throw":true,"single_quote":true,"single_trait_insert_per_statement":true,"space_after_semicolon":{"remove_in_empty_for_expressions":true},"standardize_increment":true,"standardize_not_equals":true,"ternary_operator_spaces":true,"trailing_comma_in_multiline_array":true,"trim_array_spaces":true,"unary_operator_spaces":true,"whitespace_after_comma_in_array":true,"yoda_style":true},"hashes":{"Tests\/Functional\/AService.php":3371820063,"Tests\/Functional\/DependencyInjection\/EnableCommandsTest.php":1794882875,"Tests\/Functional\/DependencyInjection\/CompilerPass\/InMemoryRepositoryCompilerPassTest.php":3620326332,"Tests\/Functional\/DependencyInjection\/CompilerPass\/TransformersCompilerPassTest.php":2286676217,"Tests\/Functional\/DependencyInjection\/CompilerPass\/HttpRepositoryCompilerPassTest.php":3050954938,"Tests\/Functional\/DependencyInjection\/ApisearchConfigurationTest.php":271608124,"Tests\/Functional\/DependencyInjection\/DisableCommandsTest.php":2271614667,"Tests\/Functional\/ApisearchBundleFunctionalTest.php":1563748362,"Tests\/Functional\/ProductWriteTransformer.php":2899478219,"Tests\/Functional\/ProductBothTransformer.php":479133393,"Tests\/Functional\/Command\/PrintIndicesCommandTest.php":481741707,"Tests\/Functional\/Command\/QueryCommandTest.php":2580406218,"Tests\/Functional\/Command\/AddDeleteTokensCommandTest.php":1868952970,"Tests\/Functional\/Command\/IndexCommandTest.php":4092266881,"Tests\/Functional\/ProductReadTransformer.php":1717369761,"Tests\/Functional\/AutowiringTest.php":1216361311,"DependencyInjection\/ApisearchExtension.php":4206190540,"DependencyInjection\/CompilerPass\/ReadTransformerCompilerPass.php":3948110591,"DependencyInjection\/CompilerPass\/ExporterCompilerPass.php":857546720,"DependencyInjection\/CompilerPass\/WriteTransformerCompilerPass.php":2530587380,"DependencyInjection\/CompilerPass\/RepositoryCompilerPass.php":3605104821,"DependencyInjection\/ApisearchConfiguration.php":1136730770,"Twig\/UrlBuilderExtension.php":1095204211,"Twig\/AggregationTranslationExtension.php":257790318,"Twig\/MethodAccessorExtension.php":2939807874,"Command\/ApisearchCommand.php":3928891909,"Command\/AddTokenCommand.php":3051589506,"Command\/WithRepositoryBucketCommand.php":1083077272,"Command\/DeleteTokensCommand.php":877678679,"Command\/ImportIndexCommand.php":3607079391,"Command\/ApisearchFormattedCommand.php":3862548494,"Command\/PrintTokensCommand.php":3348297778,"Command\/DeleteIndexCommand.php":1546190123,"Command\/DeleteTokenCommand.php":3627377100,"Command\/QueryCommand.php":2332984996,"Command\/WithAppRepositoryBucketCommand.php":759489361,"Command\/PrintIndicesCommand.php":885255525,"Command\/ResetIndexCommand.php":4125855051,"Command\/ConfigureIndexCommand.php":2323095110,"Command\/CreateIndexCommand.php":435275942,"Command\/ExportIndexCommand.php":3253784633,"Translator\/AggregationTranslator.php":3711919960,"ApisearchBundle.php":4293551145}}
1+
{"php":"7.3.11-1+ubuntu18.04.1+deb.sury.org+1","version":"2.16.0:v2.16.0#ceaff36bee1ed3f1bbbedca36d2528c0826c336d","indent":" ","lineEnding":"\n","rules":{"blank_line_after_namespace":true,"braces":{"allow_single_line_closure":true},"class_definition":{"single_line":true},"constant_case":true,"elseif":true,"function_declaration":true,"indentation_type":true,"line_ending":true,"lowercase_keywords":true,"method_argument_space":true,"no_break_comment":true,"no_closing_tag":true,"no_spaces_after_function_name":true,"no_spaces_inside_parenthesis":true,"no_trailing_whitespace":true,"no_trailing_whitespace_in_comment":true,"single_blank_line_at_eof":true,"single_class_element_per_statement":true,"single_import_per_statement":true,"single_line_after_imports":true,"switch_case_semicolon_to_colon":true,"switch_case_space":true,"visibility_required":true,"encoding":true,"full_opening_tag":true,"array_syntax":{"syntax":"short"},"binary_operator_spaces":true,"blank_line_after_opening_tag":true,"blank_line_before_statement":{"statements":["return"]},"cast_spaces":true,"class_attributes_separation":{"elements":["method"]},"concat_space":true,"declare_equal_normalize":true,"function_typehint_space":true,"include":true,"increment_style":true,"lowercase_cast":true,"lowercase_static_reference":true,"magic_constant_casing":true,"magic_method_casing":true,"native_function_casing":true,"native_function_type_declaration_casing":true,"new_with_braces":true,"no_blank_lines_after_class_opening":true,"no_blank_lines_after_phpdoc":true,"no_empty_comment":true,"no_empty_phpdoc":true,"no_empty_statement":true,"no_extra_blank_lines":{"tokens":["curly_brace_block","extra","parenthesis_brace_block","square_brace_block","throw","use"]},"no_leading_import_slash":true,"no_leading_namespace_whitespace":true,"no_mixed_echo_print":true,"no_multiline_whitespace_around_double_arrow":true,"no_short_bool_cast":true,"no_singleline_whitespace_before_semicolons":true,"no_spaces_around_offset":true,"no_superfluous_phpdoc_tags":{"allow_mixed":true,"allow_unused_params":true},"no_trailing_comma_in_list_call":true,"no_trailing_comma_in_singleline_array":true,"no_unneeded_control_parentheses":true,"no_unneeded_curly_braces":true,"no_unneeded_final_method":true,"no_unused_imports":true,"no_whitespace_before_comma_in_array":true,"no_whitespace_in_blank_line":true,"normalize_index_brace":true,"object_operator_without_whitespace":true,"ordered_imports":true,"php_unit_fqcn_annotation":true,"phpdoc_align":{"tags":["method","param","property","return","throws","type","var"]},"phpdoc_annotation_without_dot":true,"phpdoc_indent":true,"phpdoc_inline_tag":true,"phpdoc_no_access":true,"phpdoc_no_alias_tag":true,"phpdoc_no_package":true,"phpdoc_no_useless_inheritdoc":true,"phpdoc_return_self_reference":true,"phpdoc_scalar":true,"phpdoc_separation":true,"phpdoc_single_line_var_spacing":true,"phpdoc_summary":true,"phpdoc_to_comment":true,"phpdoc_trim":true,"phpdoc_trim_consecutive_blank_line_separation":true,"phpdoc_types":true,"phpdoc_types_order":{"null_adjustment":"always_last","sort_algorithm":"none"},"phpdoc_var_without_name":true,"return_type_declaration":true,"semicolon_after_instruction":true,"short_scalar_cast":true,"single_blank_line_before_namespace":true,"single_line_comment_style":{"comment_types":["hash"]},"single_line_throw":true,"single_quote":true,"single_trait_insert_per_statement":true,"space_after_semicolon":{"remove_in_empty_for_expressions":true},"standardize_increment":true,"standardize_not_equals":true,"ternary_operator_spaces":true,"trailing_comma_in_multiline_array":true,"trim_array_spaces":true,"unary_operator_spaces":true,"whitespace_after_comma_in_array":true,"yoda_style":true},"hashes":{"\/tmp\/phpcsfixer_temp.tmp2\/Drift\/AsyncTestClient.php":2013804296,"\/tmp\/phpcsfixer_temp.tmp4\/Drift\/AsyncTestClient.php":2230888305}}

ApisearchBundle.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ public function getContainerExtension()
6666
public static function getBundleDependencies(KernelInterface $kernel): array
6767
{
6868
return [
69-
BaseBundle::class,
7069
FrameworkBundle::class,
7170
];
7271
}

DependencyInjection/CompilerPass/ExporterCompilerPass.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515

1616
namespace Apisearch\DependencyInjection\CompilerPass;
1717

18-
use Mmoreram\BaseBundle\CompilerPass\TagCompilerPass;
19-
2018
/**
2119
* Class ExporterCompilerPass.
2220
*/

DependencyInjection/CompilerPass/ReadTransformerCompilerPass.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515

1616
namespace Apisearch\DependencyInjection\CompilerPass;
1717

18-
use Mmoreram\BaseBundle\CompilerPass\TagCompilerPass;
19-
2018
/**
2119
* Class ReadTransformerCompilerPass.
2220
*/
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the BaseBundle for Symfony2.
5+
*
6+
* For the full copyright and license information, please view the LICENSE
7+
* file that was distributed with this source code.
8+
*
9+
* Feel free to edit as you please, and have fun.
10+
*
11+
* @author Marc Morera <[email protected]>
12+
*/
13+
14+
declare(strict_types=1);
15+
16+
namespace Apisearch\DependencyInjection\CompilerPass;
17+
18+
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
19+
use Symfony\Component\DependencyInjection\Compiler\PriorityTaggedServiceTrait;
20+
use Symfony\Component\DependencyInjection\ContainerBuilder;
21+
use Symfony\Component\DependencyInjection\Reference;
22+
23+
/**
24+
* Class TagCompilerPass.
25+
*/
26+
abstract class TagCompilerPass implements CompilerPassInterface
27+
{
28+
use PriorityTaggedServiceTrait;
29+
30+
/**
31+
* You can modify the container here before it is dumped to PHP code.
32+
*
33+
* @param ContainerBuilder $container
34+
*/
35+
public function process(ContainerBuilder $container)
36+
{
37+
if (!$container->has($this->getCollectorServiceName())) {
38+
return;
39+
}
40+
41+
$definition = $container->findDefinition(
42+
$this->getCollectorServiceName()
43+
);
44+
45+
$taggedServices = $this->findAndSortTaggedServices(
46+
$this->getTagName(),
47+
$container
48+
);
49+
50+
/*
51+
* Per each service, add a new method call reference
52+
*/
53+
foreach ($taggedServices as $service) {
54+
$definition->addMethodCall(
55+
$this->getCollectorMethodName(),
56+
[$service]
57+
);
58+
}
59+
}
60+
61+
/**
62+
* Get collector service name.
63+
*
64+
* @return string Collector service name
65+
*/
66+
abstract public function getCollectorServiceName(): string;
67+
68+
/**
69+
* Get collector method name.
70+
*
71+
* @return string Collector method name
72+
*/
73+
abstract public function getCollectorMethodName(): string;
74+
75+
/**
76+
* Get tag name.
77+
*
78+
* @return string Tag name
79+
*/
80+
abstract public function getTagName(): string;
81+
}

DependencyInjection/CompilerPass/WriteTransformerCompilerPass.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515

1616
namespace Apisearch\DependencyInjection\CompilerPass;
1717

18-
use Mmoreram\BaseBundle\CompilerPass\TagCompilerPass;
19-
2018
/**
2119
* Class WriteTransformerCompilerPass.
2220
*/

Drift/AsyncTestClient.php

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Apisearch PHP Client.
5+
*
6+
* For the full copyright and license information, please view the LICENSE
7+
* file that was distributed with this source code.
8+
*
9+
* Feel free to edit as you please, and have fun.
10+
*
11+
* @author Marc Morera <[email protected]>
12+
*/
13+
14+
declare(strict_types=1);
15+
16+
namespace Apisearch\Drift;
17+
18+
use Apisearch\Http\Client;
19+
use Apisearch\Http\HttpClient;
20+
use Apisearch\Http\RetryMap;
21+
use Clue\React\Block;
22+
use Drift\HttpKernel\AsyncKernel;
23+
use Symfony\Component\HttpFoundation\Request;
24+
25+
/**
26+
* Class AsyncTestClient.
27+
*/
28+
class AsyncTestClient extends Client implements HttpClient
29+
{
30+
/**
31+
* @var AsyncKernel
32+
*
33+
* Async kernel
34+
*/
35+
private $kernel;
36+
37+
/**
38+
* TestClient constructor.
39+
*
40+
* @param AsyncKernel $kernel
41+
* @param string $version
42+
* @param RetryMap $retryMap
43+
*/
44+
public function __construct(
45+
AsyncKernel $kernel,
46+
string $version,
47+
RetryMap $retryMap
48+
) {
49+
$this->kernel = $kernel;
50+
51+
parent::__construct(
52+
$version,
53+
$retryMap
54+
);
55+
}
56+
57+
/**
58+
* Get a response given some parameters.
59+
* Return an array with the status code and the body.
60+
*
61+
* @param string $url
62+
* @param string $method
63+
* @param array $query
64+
* @param array $body
65+
* @param array $server
66+
*
67+
* @return array
68+
*/
69+
public function get(
70+
string $url,
71+
string $method,
72+
array $query = [],
73+
array $body = [],
74+
array $server = []
75+
): array {
76+
$method = trim(strtolower($method));
77+
$requestParts = $this->buildRequestParts(
78+
$url,
79+
$query,
80+
$body,
81+
$server
82+
);
83+
84+
$headersFormatted = [];
85+
foreach ($server as $key => $value) {
86+
$headersFormatted['HTTP_'.str_replace('-', '_', $key)] = $value;
87+
}
88+
89+
$request = new Request(
90+
array_map('urldecode', $query),
91+
[],
92+
[],
93+
[],
94+
[],
95+
array_merge($headersFormatted, [
96+
'CONTENT_TYPE' => 'application/json',
97+
'HTTP_REFERER' => 'http://localhost',
98+
]),
99+
json_encode($requestParts->getParameters()['json'])
100+
);
101+
102+
$request->setMethod($method);
103+
$request->server->set('REQUEST_URI', $requestParts->getUrl());
104+
105+
$promise = $this
106+
->kernel
107+
->handleAsync($request);
108+
109+
$response = Block\await(
110+
$promise,
111+
$this
112+
->kernel
113+
->getContainer()
114+
->get('reactphp.event_loop')
115+
);
116+
117+
return [
118+
'code' => $response->getStatusCode(),
119+
'body' => json_decode($response->getContent(), true),
120+
];
121+
}
122+
}

Tests/Functional/DependencyInjection/CompilerPass/TransformersCompilerPassTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,5 +98,6 @@ protected static function getKernel(): KernelInterface
9898
public function testBothTransormers()
9999
{
100100
// No error means that the transformers have been properly built
101+
$this->assertTrue(true);
101102
}
102103
}

composer.json

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -14,37 +14,23 @@
1414
],
1515
"require": {
1616
"php": ">=7.1",
17-
"symfony/framework-bundle": "^3.0|^4.0",
18-
"symfony/http-kernel": "^3.0|^4.0",
19-
"symfony/stopwatch": "^3.0|^4.0",
20-
"symfony/console": "^3.0|^4.0",
17+
"symfony/framework-bundle": "^3.0|^4.0|^5.0",
18+
"symfony/http-kernel": "^3.0|^4.0|^5.0",
19+
"symfony/stopwatch": "^3.0|^4.0|^5.0",
20+
"symfony/console": "^3.0|^4.0|^5.0",
2121
"ramsey/uuid": "^3.7.1",
22-
"mmoreram/base-bundle": "^1.0",
22+
"mmoreram/base-bundle": "^2.0.0",
2323
"apisearch-io/php-client": "dev-master"
2424
},
25-
"suggested": {
26-
"twig/twig": "In case you use Twig engine",
27-
"symfony/translator": "^3.0|^4.0 in case you use Macros translations"
28-
},
2925
"require-dev": {
30-
"phpunit/phpunit": "^5.6.5",
31-
"mmoreram/php-formatter": "^1.3.1",
32-
"friendsofphp/php-cs-fixer": "^2.5.0",
3326
"mmoreram/symfony-bundle-dependencies": "^2.1",
34-
"symfony/browser-kit": "^3.4|^4.0"
27+
"drift/http-kernel": "dev-master@dev",
28+
"symfony/browser-kit": "^3.4|^4.0|^5.0"
3529
},
3630
"autoload": {
3731
"psr-4": {
3832
"Apisearch\\": ""
3933
}
4034
},
41-
"scripts": {
42-
"fix-code": [
43-
"vendor/bin/php-cs-fixer fix --config=.php_cs",
44-
"vendor/bin/php-formatter f:h:f . --exclude=vendor --exclude=var",
45-
"vendor/bin/php-formatter f:s:f . --exclude=vendor --exclude=var",
46-
"vendor/bin/php-formatter f:u:s . --exclude=vendor --exclude=var"
47-
],
48-
"test": "vendor/bin/phpunit"
49-
}
35+
"minimum-stability": "dev"
5036
}

0 commit comments

Comments
 (0)