Commit 556104d5 authored by slashrsm's avatar slashrsm Committed by slashrsm

Issue #2708045 by slashrsm: Move default configuration to crm_core_demo module

parent 7525cd94
......@@ -2,7 +2,9 @@
namespace Drupal\crm_core_activity\Tests;
use Drupal\crm_core_activity\Entity\ActivityType;
use Drupal\crm_core_contact\Entity\Individual;
use Drupal\crm_core_contact\Entity\IndividualType;
use Drupal\simpletest\WebTestBase;
/**
......@@ -38,6 +40,25 @@ class ActivityUiTest extends WebTestBase {
$this->drupalPlaceBlock('local_actions_block');
$this->drupalPlaceBlock('local_tasks_block');
IndividualType::create([
'name' => 'Customer',
'type' => 'customer',
'description' => 'A single customer.',
'primary_fields' => [],
])->save();
ActivityType::create([
'type' => 'meeting',
'name' => 'Meeting',
'description' => 'A meeting between 2 or more contacts.',
])->save();
ActivityType::create([
'type' => 'phone_call',
'name' => 'Phone call',
'description' => 'A phone call between 2 or more contacts.',
])->save();
$this->drupalPlaceBlock('system_breadcrumb_block');
}
......
......@@ -3,6 +3,7 @@
namespace Drupal\crm_core_contact\Tests;
use Drupal\crm_core_contact\Entity\Individual;
use Drupal\crm_core_contact\Entity\IndividualType;
use Drupal\simpletest\WebTestBase;
/**
......@@ -33,6 +34,13 @@ class IndividualUiTest extends WebTestBase {
public function setUp() {
parent::setUp();
IndividualType::create([
'name' => 'Customer',
'type' => 'customer',
'description' => 'A single customer.',
'primary_fields' => [],
])->save();
// Place local actions and local task blocks.
$this->drupalPlaceBlock('local_actions_block');
$this->drupalPlaceBlock('local_tasks_block');
......
......@@ -33,6 +33,20 @@ class OrganizationUiTest extends WebTestBase {
public function setUp() {
parent::setUp();
OrganizationType::create([
'label' => 'Supplier',
'id' => 'supplier',
'description' => 'A person or company that supplies goods or services.',
'primary_fields' => [],
])->save();
OrganizationType::create([
'label' => 'Household',
'id' => 'household',
'description' => 'A collection of individuals generally located at the same residence.',
'primary_fields' => [],
])->save();
// Place local actions and local task blocks.
$this->drupalPlaceBlock('local_actions_block');
$this->drupalPlaceBlock('local_tasks_block');
......
name: CRM Core demo
type: module
description: 'Provides demo configuration for the CRM core.'
package: CRM Core
version: 8.x-1.x-dev
core: 8.x
dependencies:
- crm_core:crm_core_contact
- crm_core:crm_core_activity
<?php
namespace Drupal\Tests\crm_core_demo\Functional;
use Drupal\crm_core_activity\Entity\ActivityType;
use Drupal\crm_core_contact\Entity\IndividualType;
use Drupal\crm_core_contact\Entity\OrganizationType;
use Drupal\Tests\BrowserTestBase;
/**
* Tests CRM core demo.
*
* @group crm_core_demo
*/
class CrmCoreDemoTest extends BrowserTestBase {
/**
* {@inheritdoc}
*/
public static $modules = [
'views',
'dynamic_entity_reference',
'crm_core',
'crm_core_contact',
'crm_core_activity',
'crm_core_demo',
];
/**
* Tests default configuration.
*/
public function testDefaultConfiguration() {
$individual = IndividualType::load('customer');
$this->assertEquals('customer', $individual->id(), 'Correct ID for the customer found.');
$this->assertEquals('Customer', $individual->label(), 'Correct label for the customer found.');
$this->assertEquals('A single customer.', $individual->getDescription(), 'Correct description for the customer found.');
$household = OrganizationType::load('household');
$this->assertEquals('household', $household->id(), 'Correct ID for the household found.');
$this->assertEquals('Household', $household->label(), 'Correct label for the household found.');
$this->assertEquals('A collection of individuals generally located at the same residence.', $household->getDescription(), 'Correct description for the supplier found.');
$supplier = OrganizationType::load('supplier');
$this->assertEquals('supplier', $supplier->id(), 'Correct ID for the supplier found.');
$this->assertEquals('Supplier', $supplier->label(), 'Correct label for the supplier found.');
$this->assertEquals('A person or company that supplies goods or services.', $supplier->getDescription(), 'Correct description for the supplier found.');
$meeting = ActivityType::load('meeting');
$this->assertEquals('meeting', $meeting->id(), 'Correct ID for the meeting found.');
$this->assertEquals('Meeting', $meeting->label(), 'Correct label for the meeting found.');
$this->assertEquals('A meeting between 2 or more contacts.', $meeting->description, 'Correct description for the meeting found.');
$phone_call = ActivityType::load('phone_call');
$this->assertEquals('phone_call', $phone_call->id(), 'Correct ID for the phone call found.');
$this->assertEquals('Phone call', $phone_call->label(), 'Correct label for the phone call found.');
$this->assertEquals('A phone call between 2 or more contacts.', $phone_call->description, 'Correct description for the meeting found.');
}
}
......@@ -2,6 +2,7 @@
namespace Drupal\crm_core_match\Tests;
use Drupal\crm_core_contact\Entity\IndividualType;
use Drupal\simpletest\WebTestBase;
/**
......@@ -29,6 +30,14 @@ class DefaultMatchingEngineUITest extends WebTestBase {
*/
public function setUp() {
parent::setUp();
IndividualType::create([
'name' => 'Customer',
'type' => 'customer',
'description' => 'A single customer.',
'primary_fields' => [],
])->save();
// Place local actions blocks.
$this->drupalPlaceBlock('local_actions_block');
$this->drupalPlaceBlock('system_breadcrumb_block');
......
......@@ -3,6 +3,7 @@
namespace Drupal\Tests\crm_core_match\Kernel;
use Drupal\crm_core_contact\Entity\Individual;
use Drupal\crm_core_contact\Entity\IndividualType;
use Drupal\crm_core_match\Entity\Matcher;
use Drupal\field\Entity\FieldConfig;
use Drupal\field\Entity\FieldStorageConfig;
......@@ -49,6 +50,13 @@ class FieldMatcherTest extends KernelTestBase {
$this->installEntitySchema('action');
$this->installEntitySchema('crm_core_individual');
IndividualType::create([
'name' => 'Customer',
'type' => 'customer',
'description' => 'A single customer.',
'primary_fields' => [],
])->save();
$this->pluginManager = $this->container->get('plugin.manager.crm_core_match.match_field');
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment