File tree Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -314,7 +314,7 @@ public function getCompanies(): array {
314314 * {@inheritdoc}
315315 */
316316 public function hasCompany (string $ company_name ): bool {
317- return $ this ->decorated -> hasCompany ( $ company_name );
317+ return in_array ( $ company_name , $ this ->getCompanies (), TRUE );
318318 }
319319
320320 /**
Original file line number Diff line number Diff line change @@ -347,9 +347,10 @@ protected function developerCreateByAdminTest() {
347347 }
348348
349349 /**
350- * Tests getCompanies() function of the developer entity.
350+ * Tests getCompanies() and hasCompany() methods on the developer entity.
351351 *
352352 * @see \Drupal\apigee_edge\Entity\Developer::getCompanies()
353+ * @see \Drupal\apigee_edge\Entity\Developer::hasCompany()
353354 */
354355 public function developerGetCompanyListTest () {
355356 // Create a new developer.
@@ -389,13 +390,15 @@ public function developerGetCompanyListTest() {
389390 /** @var \Drupal\apigee_edge\Entity\DeveloperInterface $developer */
390391 $ developer = $ this ->developerStorage ->loadMultiple ()[$ this ->developer ->id ()];
391392 $ this ->assertContains ($ this ->company ->getName (), $ developer ->getCompanies ());
393+ self ::assertTrue ($ developer ->hasCompany ($ this ->company ->getName ()));
392394
393395 // Check the companies array if the developer is removed from the member
394396 // list.
395397 $ company_membership_controller ->removeMember ($ this ->developer ->getEmail ());
396398 $ developer_cache ->removeEntities ([$ this ->developer ->id ()]);
397399 $ developer = $ this ->developerStorage ->loadUnchanged ($ this ->developer ->id ());
398400 $ this ->assertNotContains ($ this ->company ->getName (), $ developer ->getCompanies ());
401+ self ::assertFalse ($ developer ->hasCompany ($ this ->company ->getName ()));
399402 }
400403
401404}
You can’t perform that action at this time.
0 commit comments