SearchKit - Change @searchable annotation from boolean to option list
[civicrm-core.git] / tests / phpunit / api / v4 / Entity / ConformanceTest.php
index 6af37e8e1378a6b07fb56af281d779c3797e99be..43af883e7159ff95f772aa55bbc8786c70171276 100644 (file)
@@ -156,6 +156,11 @@ class ConformanceTest extends UnitTestCase {
     $this->assertNotEmpty($info['title_plural']);
     $this->assertNotEmpty($info['type']);
     $this->assertNotEmpty($info['description']);
+    $this->assertContains($info['searchable'], ['primary', 'secondary', 'none']);
+    // Bridge must be between exactly 2 entities
+    if (in_array('EntityBridge', $info['type'], TRUE)) {
+      $this->assertCount(2, $info['bridge']);
+    }
   }
 
   /**
@@ -173,7 +178,8 @@ class ConformanceTest extends UnitTestCase {
     $errMsg = sprintf('%s is missing required ID field', $entity);
     $subset = ['data_type' => 'Integer'];
 
-    $this->assertArraySubset($subset, $fields['id'], $errMsg);
+    $this->assertArrayHasKey('data_type', $fields['id'], $errMsg);
+    $this->assertEquals('Integer', $fields['id']['data_type']);
   }
 
   /**
@@ -228,7 +234,7 @@ class ConformanceTest extends UnitTestCase {
     catch (\API_Exception $e) {
       $exceptionThrown = $e->getMessage();
     }
-    $this->assertContains('id', $exceptionThrown);
+    $this->assertStringContainsString('id', $exceptionThrown);
   }
 
   /**
@@ -278,7 +284,7 @@ class ConformanceTest extends UnitTestCase {
     catch (\API_Exception $e) {
       $exceptionThrown = $e->getMessage();
     }
-    $this->assertContains('required', $exceptionThrown);
+    $this->assertStringContainsString('required', $exceptionThrown);
   }
 
   /**
@@ -294,8 +300,8 @@ class ConformanceTest extends UnitTestCase {
     catch (\API_Exception $e) {
       $exceptionThrown = $e->getMessage();
     }
-    $this->assertContains('debug', $exceptionThrown);
-    $this->assertContains('type', $exceptionThrown);
+    $this->assertStringContainsString('debug', $exceptionThrown);
+    $this->assertStringContainsString('type', $exceptionThrown);
   }
 
   /**