diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index 1ff817e..0372f4e 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -32,7 +32,7 @@ jobs: fail-fast: false matrix: php: - - '8.2' + - '8.3' db: - '{"vendor": "MySQL 8.0", "pdo": "mysql", "dsn": "mysql://bedita:bedita@127.0.0.1:3306/bedita", "image": "mysql:8.0", "options": "--health-cmd \"mysqladmin ping -h localhost\" --health-interval 10s --health-timeout 5s --health-retries 5"}' elastic: @@ -43,13 +43,13 @@ jobs: - '{"vendor": "ElasticSearch 8", "image": "elasticsearch:8.11.0", "dsn": "http://elastic:admin@127.0.0.1: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:bedita@127.0.0.1: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:bedita@127.0.0.1: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' diff --git a/composer.json b/composer.json index f450ddb..f59b9cc 100644 --- a/composer.json +++ b/composer.json @@ -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": { @@ -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 } } } diff --git a/tests/Fixture/ObjectTypesFixture.php b/tests/Fixture/ObjectTypesFixture.php index e847b62..0309f5a 100644 --- a/tests/Fixture/ObjectTypesFixture.php +++ b/tests/Fixture/ObjectTypesFixture.php @@ -15,7 +15,7 @@ class ObjectTypesFixture extends BEditaObjectTypesFixture * * @var array */ - public $records = [ + public array $records = [ // 1 [ 'singular' => 'object', diff --git a/tests/Fixture/ObjectsFixture.php b/tests/Fixture/ObjectsFixture.php index 01450bd..842182c 100644 --- a/tests/Fixture/ObjectsFixture.php +++ b/tests/Fixture/ObjectsFixture.php @@ -15,7 +15,7 @@ class ObjectsFixture extends BEditaObjectsFixture * * @var array */ - public $records = [ + public array $records = [ // 1 [ 'object_type_id' => 2, // users diff --git a/tests/TestCase/Adapter/ElasticSearchAdapterTest.php b/tests/TestCase/Adapter/ElasticSearchAdapterTest.php index e89c5c0..e70e007 100644 --- a/tests/TestCase/Adapter/ElasticSearchAdapterTest.php +++ b/tests/TestCase/Adapter/ElasticSearchAdapterTest.php @@ -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 */ - public function getIndexProvider(): array + public static function getIndexProvider(): array { /** @var \Cake\ElasticSearch\Datasource\IndexLocator $locator */ $locator = FactoryLocator::get('ElasticSearch'); @@ -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) { @@ -86,7 +78,6 @@ public function getIndex(): Index&AdapterCompatibleInterface * Test `buildElasticSearchQuery` method * * @return void - * @covers ::buildElasticSearchQuery() */ public function testBuildElasticSearchQuery(): void { @@ -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, @@ -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 { @@ -176,7 +160,6 @@ protected function buildElasticSearchQuery(string $text, array $options): array * Test `createTempTable` method * * @return void - * @covers ::createTempTable() */ public function testCreateTempTable(): void { diff --git a/tests/TestCase/Index/SearchIndexTest.php b/tests/TestCase/Index/SearchIndexTest.php index 35ab43c..15ad212 100644 --- a/tests/TestCase/Index/SearchIndexTest.php +++ b/tests/TestCase/Index/SearchIndexTest.php @@ -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; @@ -43,7 +43,6 @@ protected function tearDown(): void * Test `create` method. * * @return void - * @covers ::create() */ public function testCreate() { @@ -55,8 +54,6 @@ public function testCreate() * Test `indexExists` method. * * @return void - * @covers ::indexExists() - * @covers ::create() */ public function testIndexExists() {