Skip to content
Draft
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
8 changes: 4 additions & 4 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
fail-fast: false
matrix:
php:
- '8.2'
- '8.3'
db:
- '{"vendor": "MySQL 8.0", "pdo": "mysql", "dsn": "mysql://bedita:[email protected]:3306/bedita", "image": "mysql:8.0", "options": "--health-cmd \"mysqladmin ping -h localhost\" --health-interval 10s --health-timeout 5s --health-retries 5"}'
elastic:
Expand All @@ -43,13 +43,13 @@ jobs:
- '{"vendor": "ElasticSearch 8", "image": "elasticsearch:8.11.0", "dsn": "http://elastic:[email protected]:9200/?className=Cake\\ElasticSearch\\Datasource\\Connection&driver=elasticsearch&auth_type=basic", "options": "--env \"xpack.security.http.ssl.enabled=false\" --health-cmd \"curl --fail --output /dev/null --silent --user elastic:admin http://localhost:9200/_cluster/health?wait_for_status=yellow&timeout=1s\" --health-interval 1s --health-timeout 2s --health-retries 5"}'
- '{"vendor": "ElasticSearch 7", "image": "elasticsearch:7.17.14", "dsn": "http://127.0.0.1:9200/?className=Cake\\ElasticSearch\\Datasource\\Connection&driver=elasticsearch", "options": "--health-cmd \"curl --fail --output /dev/null --silent http://localhost:9200/_cluster/health?wait_for_status=yellow&timeout=1s\" --health-interval 1s --health-timeout 2s --health-retries 5"}'
include:
- php: '8.2'
- php: '8.3'
db: '{"vendor": "SQLite", "pdo": "sqlite", "dsn": "sqlite://tmp/test.sql", "image": "busybox", "options": "--entrypoint \"/bin/yes\" --health-cmd \"/bin/true\" --health-interval 1s --health-timeout 2s --health-retries 5"}'
elastic: '{"vendor": "OpenSearch 2", "image": "opensearchproject/opensearch:2", "dsn": "http://127.0.0.1:9200/?className=Cake\\ElasticSearch\\Datasource\\Connection&driver=opensearch", "options": "--health-cmd \"curl --fail --output /dev/null --silent http://localhost:9200/_cluster/health?wait_for_status=yellow&timeout=1s\" --health-interval 1s --health-timeout 2s --health-retries 5"}'
- php: '8.2'
- php: '8.3'
db: '{"vendor": "MySQL 5.7", "pdo": "mysql", "dsn": "mysql://bedita:[email protected]:3306/bedita?realVendor=mysql5.7", "image": "mysql:5.7", "options": "--health-cmd \"mysqladmin ping -h localhost\" --health-interval 10s --health-timeout 5s --health-retries 5"}'
elastic: '{"vendor": "OpenSearch 2", "image": "opensearchproject/opensearch:2", "dsn": "http://127.0.0.1:9200/?className=Cake\\ElasticSearch\\Datasource\\Connection&driver=opensearch", "options": "--health-cmd \"curl --fail --output /dev/null --silent http://localhost:9200/_cluster/health?wait_for_status=yellow&timeout=1s\" --health-interval 1s --health-timeout 2s --health-retries 5"}'
- php: '8.2'
- php: '8.3'
db: '{"vendor": "PostgreSQL", "pdo": "pgsql", "dsn": "postgres://bedita:[email protected]:5432/bedita", "image": "postgres:14", "options": "--health-cmd \"pg_isready\" --health-interval 10s --health-timeout 5s --health-retries 5"}'
elastic: '{"vendor": "OpenSearch 2", "image": "opensearchproject/opensearch:2", "dsn": "http://127.0.0.1:9200/?className=Cake\\ElasticSearch\\Datasource\\Connection&driver=opensearch", "options": "--health-cmd \"curl --fail --output /dev/null --silent http://localhost:9200/_cluster/health?wait_for_status=yellow&timeout=1s\" --health-interval 1s --health-timeout 2s --health-retries 5"}'
- php: '8.3'
Expand Down
23 changes: 12 additions & 11 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,18 @@
}
],
"require": {
"php": "^8.1",
"cakephp/cakephp": "^4.4.1",
"cakephp/elastic-search": "^3.4",
"bedita/core": "^5.19.0",
"ruflin/elastica": "^7.1",
"elasticsearch/elasticsearch": "^7.10"
"php": "^8.3",
"cakephp/cakephp": "^5.2.0",
"cakephp/elastic-search": "^5.0",
"bedita/core": "^6.0.0",
"ruflin/elastica": "^9.0",
"elasticsearch/elasticsearch": "^9.2"
},
"require-dev": {
"phpunit/phpunit": "^9.6",
"cakephp/cakephp-codesniffer": "^5.1",
"phpstan/phpstan": "^1.10",
"phpstan/phpstan-phpunit": "^1.3"
"phpunit/phpunit": "^12.1",
"cakephp/cakephp-codesniffer": "^5.3",
"phpstan/phpstan": "^2.1",
"phpstan/phpstan-phpunit": "^2.0"
},
"autoload": {
"psr-4": {
Expand Down Expand Up @@ -59,7 +59,8 @@
"config": {
"allow-plugins": {
"cakephp/plugin-installer": true,
"dealerdirect/phpcodesniffer-composer-installer": true
"dealerdirect/phpcodesniffer-composer-installer": true,
"php-http/discovery": false
}
}
}
2 changes: 1 addition & 1 deletion tests/Fixture/ObjectTypesFixture.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class ObjectTypesFixture extends BEditaObjectTypesFixture
*
* @var array
*/
public $records = [
public array $records = [
// 1
[
'singular' => 'object',
Expand Down
2 changes: 1 addition & 1 deletion tests/Fixture/ObjectsFixture.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class ObjectsFixture extends BEditaObjectsFixture
*
* @var array
*/
public $records = [
public array $records = [
// 1
[
'object_type_id' => 2, // users
Expand Down
29 changes: 6 additions & 23 deletions tests/TestCase/Adapter/ElasticSearchAdapterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,30 +14,23 @@
use Cake\ORM\Query;
use Cake\ORM\Table;
use Exception;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\DataProvider;
use ReflectionClass;
use UnexpectedValueException;

/**
* {@see \BEdita\ElasticSearch\Adapter\ElasticSearchAdapter} Test Case
*
* @coversDefaultClass \BEdita\ElasticSearch\Adapter\ElasticSearchAdapter
*/
#[CoversClass(ElasticSearchAdapter::class)]
class ElasticSearchAdapterTest extends TestCase
{
/**
* @inheritDoc
*/
protected $fixtures = [
// 'plugin.BEdita/Core.ObjectTypes',
// 'plugin.BEdita/Core.Objects',
];

/**
* Data provider for {@see ElasticSearchAdapterTest::testGetIndex()} test case.
*
* @return array<string, array{\Cake\ElasticSearch\Index|Exception, string|\Cake\ElasticSearch\Index}>
*/
public function getIndexProvider(): array
public static function getIndexProvider(): array
{
/** @var \Cake\ElasticSearch\Datasource\IndexLocator $locator */
$locator = FactoryLocator::get('ElasticSearch');
Expand All @@ -61,9 +54,8 @@ public function getIndexProvider(): array
* @param \Cake\ElasticSearch\Index|Exception $expected Expected outcome.
* @param string|\Cake\ElasticSearch\Index $index Index configuration.
* @return void
* @dataProvider getIndexProvider()
* @covers ::getIndex()
*/
#[DataProvider('getIndexProvider')]
public function testGetIndex(Index|Exception $expected, string|Index $index): void
{
if ($expected instanceof Exception) {
Expand All @@ -86,7 +78,6 @@ public function getIndex(): Index&AdapterCompatibleInterface
* Test `buildElasticSearchQuery` method
*
* @return void
* @covers ::buildElasticSearchQuery()
*/
public function testBuildElasticSearchQuery(): void
{
Expand Down Expand Up @@ -128,11 +119,8 @@ public function searchProvider(): array
* @param string $text
* @param array $options
* @return void
* @covers ::search()
* @covers ::buildQuery()
* @covers ::buildElasticSearchQuery()
* @dataProvider searchProvider()
*/
#[DataProvider('searchProvider')]
public function testSearch(
string $expected,
Query $query,
Expand All @@ -149,10 +137,6 @@ public function testSearch(
* Test `search` with elastic search
*
* @return void
* @covers ::search()
* @covers ::buildQuery()
* @covers ::buildElasticSearchQuery()
* @covers ::createTempTable()
*/
public function testSearchElastic(): void
{
Expand All @@ -176,7 +160,6 @@ protected function buildElasticSearchQuery(string $text, array $options): array
* Test `createTempTable` method
*
* @return void
* @covers ::createTempTable()
*/
public function testCreateTempTable(): void
{
Expand Down
7 changes: 2 additions & 5 deletions tests/TestCase/Index/SearchIndexTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
use BEdita\ElasticSearch\Model\Index\SearchIndex;
use Cake\Datasource\ConnectionManager;
use Cake\ElasticSearch\TestSuite\TestCase;
use PHPUnit\Framework\Attributes\CoversClass;

/**
* {@see \BEdita\ElasticSearch\Model\Index\SearchIndex} Test Case
*
* @coversDefaultClass \BEdita\ElasticSearch\Model\Index\SearchIndex
*/
#[CoversClass(SearchIndex::class)]
class SearchIndexTest extends TestCase
{
protected SearchIndex $index;
Expand Down Expand Up @@ -43,7 +43,6 @@ protected function tearDown(): void
* Test `create` method.
*
* @return void
* @covers ::create()
*/
public function testCreate()
{
Expand All @@ -55,8 +54,6 @@ public function testCreate()
* Test `indexExists` method.
*
* @return void
* @covers ::indexExists()
* @covers ::create()
*/
public function testIndexExists()
{
Expand Down
Loading