From 36cce3cf3fb4952ce6013a97aa7395e959cf7876 Mon Sep 17 00:00:00 2001 From: Jens Schuppe Date: Wed, 3 Jul 2024 14:52:45 +0200 Subject: [PATCH] [#135] Update PHPUnit Tests to specify covers attribute and convert phpunit xml dist to be phpunit9 supported --- phpunit.xml.dist | 34 +++++++------------ .../api/v4/EckEntity/EckEntityTest.php | 12 +++++++ 2 files changed, 25 insertions(+), 21 deletions(-) diff --git a/phpunit.xml.dist b/phpunit.xml.dist index d1b677c..9afb059 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,33 +1,25 @@ - - + + + + api + CRM + Civi + + + CRM/*/DAO + CRM/*/Upgrader + + - + - ./tests/phpunit - - - api - CRM - Civi - - CRM/*/DAO - CRM/*/Upgrader - - - diff --git a/tests/phpunit/api/v4/EckEntity/EckEntityTest.php b/tests/phpunit/api/v4/EckEntity/EckEntityTest.php index a3598d1..470a5af 100644 --- a/tests/phpunit/api/v4/EckEntity/EckEntityTest.php +++ b/tests/phpunit/api/v4/EckEntity/EckEntityTest.php @@ -21,6 +21,9 @@ public function setUpHeadless(): CiviEnvBuilder { ->apply(); } + /** + * @covers \Civi\Api4\EckEntityType::create + */ public function testCreateEntityType():void { $entityType = EckEntityType::create(FALSE) ->addValue('label', 'Test One Type') @@ -77,6 +80,9 @@ public function testCreateEntityType():void { self::assertArrayNotHasKey('Eck_Test_One_Type', $extends['options']); } + /** + * @covers \Civi\Api4\EckEntityType::update + */ public function testRenameEntityType():void { $entityType = EckEntityType::create(FALSE) ->addValue('label', 'Test Two Type') @@ -110,6 +116,9 @@ public function testRenameEntityType():void { self::assertStringContainsString('not allowed', $e->getMessage()); } + /** + * @covers \Civi\Api4\EckEntityType::get + */ public function testTwoEntityTypes(): void { $firstEntity = $this->createEntity(['one' => 'One', 'two' => 'Two']); $secondEntity = $this->createEntity(['one' => 'One', 'three' => 'Three']); @@ -191,6 +200,9 @@ public function testTwoEntityTypes(): void { self::assertEquals('three', $secondRecords[1]['subtype:name']); } + /** + * @covers \Civi\Api4\EckEntityType::get + */ public function testEntityCustomFields(): void { $entityName = $this->createEntity(['one' => 'One', 'two' => 'Two']);