0
0
Fork 0
mirror of https://github.com/salesagility/SuiteCRM.git synced 2025-02-21 20:56:08 +00:00
salesagility_SuiteCRM/tests/unit/phpunit/modules/EmailMarketing/EmailMarketingTest.php
j.dang f1ac628023 Replace explicit bean instantiations in files 141 - 150
- File: '... /tests/unit/phpunit/modules/EmailMan/EmailManTest.php'

   - Replaced 15 occurrence(s) of 'new EmailMan()'

   - Replaced 2 occurrence(s) of 'new Contact()'

   - Replaced 3 occurrence(s) of 'new Email()'

   - Replaced 1 occurrence(s) of 'new User()'

- File: '... /tests/unit/phpunit/modules/Employees/EmployeeTest.php'

   - Replaced 1 occurrence(s) of 'new User()'

   - Replaced 12 occurrence(s) of 'new Employee()'

- File: '... /tests/unit/phpunit/modules/Trackers/TrackerTest.php'

   - Replaced 1 occurrence(s) of 'new User()'

   - Replaced 4 occurrence(s) of 'new Tracker()'

- File: '... /tests/unit/phpunit/modules/Opportunities/OpportunityTest.php'

   - Replaced 18 occurrence(s) of 'new Opportunity()'

   - Replaced 1 occurrence(s) of 'new User()'

- File: '... /tests/unit/phpunit/modules/AOK_Knowledge_Base_Categories/AOK_Knowledge_Base_CategoriesTest.php'

   - Replaced 1 occurrence(s) of 'new AOK_Knowledge_Base_Categories()'

- File: '... /tests/unit/phpunit/modules/AOS_Line_Item_Groups/AOS_Line_Item_GroupsTest.php'

   - Replaced 1 occurrence(s) of 'new User()'

   - Replaced 1 occurrence(s) of 'new AOS_Contracts()'

   - Replaced 3 occurrence(s) of 'new AOS_Line_Item_Groups()'

- File: '... /tests/unit/phpunit/modules/Bugs/BugTest.php'

   - Replaced 13 occurrence(s) of 'new Bug()'

   - Replaced 1 occurrence(s) of 'new User()'

- File: '... /tests/unit/phpunit/modules/EmailMarketing/EmailMarketingTest.php'

   - Replaced 7 occurrence(s) of 'new EmailMarketing()'

- File: '... /tests/unit/phpunit/modules/AOS_Contracts/AOS_ContractsTest.php'

   - Replaced 1 occurrence(s) of 'new User()'

   - Replaced 3 occurrence(s) of 'new AOS_Contracts()'

- File: '... /tests/unit/phpunit/modules/jjwg_Address_Cache/jjwg_Address_CacheTest.php'

   - Replaced 5 occurrence(s) of 'new jjwg_Address_Cache()'
2020-01-22 13:51:01 +00:00

87 lines
3.9 KiB
PHP

<?php
use SuiteCRM\Test\SuitePHPUnitFrameworkTestCase;
class EmailMarketingTest extends SuitePHPUnitFrameworkTestCase
{
public function testEmailMarketing()
{
// execute the constructor and check for the Object type and attributes
$emailMarketing = BeanFactory::newBean('EmailMarketing');
$this->assertInstanceOf('EmailMarketing', $emailMarketing);
$this->assertInstanceOf('SugarBean', $emailMarketing);
$this->assertAttributeEquals('EmailMarketing', 'module_dir', $emailMarketing);
$this->assertAttributeEquals('EmailMarketing', 'object_name', $emailMarketing);
$this->assertAttributeEquals('email_marketing', 'table_name', $emailMarketing);
$this->assertAttributeEquals(true, 'new_schema', $emailMarketing);
}
public function testretrieve()
{
$emailMarketing = BeanFactory::newBean('EmailMarketing');
$result = $emailMarketing->retrieve();
$this->assertInstanceOf('EmailMarketing', $result);
}
public function testget_summary_text()
{
$emailMarketing = BeanFactory::newBean('EmailMarketing');
// test without setting name
$this->assertEquals(null, $emailMarketing->get_summary_text());
// test with name set
$emailMarketing->name = 'test';
$this->assertEquals('test', $emailMarketing->get_summary_text());
}
public function testcreate_export_query()
{
$emailMarketing = BeanFactory::newBean('EmailMarketing');
//test with empty string params
$expected = " SELECT email_marketing.* , jt0.name template_name , jt0.assigned_user_id template_name_owner , 'EmailTemplates' template_name_mod FROM email_marketing LEFT JOIN email_templates jt0 ON email_marketing.template_id=jt0.id AND jt0.deleted=0\n\n AND jt0.deleted=0 where email_marketing.deleted=0";
$actual = $emailMarketing->create_export_query('', '');
$this->assertSame($expected, $actual);
//test with valid string params
$expected = " SELECT email_marketing.* , jt0.name template_name , jt0.assigned_user_id template_name_owner , 'EmailTemplates' template_name_mod FROM email_marketing LEFT JOIN email_templates jt0 ON email_marketing.template_id=jt0.id AND jt0.deleted=0\n\n AND jt0.deleted=0 where (email_marketing.name=\"\") AND email_marketing.deleted=0";
$actual = $emailMarketing->create_export_query('email_marketing.id', 'email_marketing.name=""');
$this->assertSame($expected, $actual);
}
public function testget_list_view_data()
{
$emailMarketing = BeanFactory::newBean('EmailMarketing');
//execute the method and verify that it retunrs expected results
$expected = array(
'ALL_PROSPECT_LISTS' => '0',
);
$actual = $emailMarketing->get_list_view_data();
$this->assertSame($expected, $actual);
}
public function testbean_implements()
{
$emailMarketing = BeanFactory::newBean('EmailMarketing');
$this->assertEquals(false, $emailMarketing->bean_implements('')); //test with blank value
$this->assertEquals(false, $emailMarketing->bean_implements('test')); //test with invalid value
$this->assertEquals(true, $emailMarketing->bean_implements('ACL')); //test with valid value
}
public function testget_all_prospect_lists()
{
$emailMarketing = BeanFactory::newBean('EmailMarketing');
//execute the method and verify that it retunrs expected results
$expected = "select prospect_lists.* from prospect_lists left join prospect_list_campaigns on prospect_list_campaigns.prospect_list_id=prospect_lists.id where prospect_list_campaigns.deleted=0 and prospect_list_campaigns.campaign_id='' and prospect_lists.deleted=0 and prospect_lists.list_type not like 'exempt%'";
$actual = $emailMarketing->get_all_prospect_lists();
$this->assertSame($expected, $actual);
}
}