You are here

public function ContactModuleTest::testIndividualSuggestions in CRM Core 8.3

Test suggestions.

@covers ::crm_core_contact_theme_suggestions_crm_core_individual

File

modules/crm_core_contact/tests/src/Unit/ContactModuleTest.php, line 28

Class

ContactModuleTest
Test the module file.

Namespace

Drupal\Tests\crm_core_contact\Unit

Code

public function testIndividualSuggestions() : void {
  $individual = $this
    ->createMock(Individual::class);
  $individual
    ->method('bundle')
    ->willReturn('customer');
  $individual
    ->method('id')
    ->willReturn(1);
  $result = crm_core_contact_theme_suggestions_crm_core_individual([
    'elements' => [
      '#crm_core_individual' => $individual,
      '#view_mode' => 'my.test',
    ],
  ]);
  $this
    ->assertArrayEquals($result, [
    'crm_core_individual__my_test',
    'crm_core_individual__customer',
    'crm_core_individual__customer__my_test',
    'crm_core_individual__1',
    'crm_core_individual__1__my_test',
  ]);
}