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/AOS_Contracts/AOS_ContractsTest.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

79 lines
2.9 KiB
PHP

<?php
use SuiteCRM\Test\SuitePHPUnitFrameworkTestCase;
class AOS_ContractsTest extends SuitePHPUnitFrameworkTestCase
{
public function setUp()
{
parent::setUp();
global $current_user;
get_sugar_config_defaults();
$current_user = BeanFactory::newBean('Users');
}
public function testAOS_Contracts()
{
// Execute the constructor and check for the Object type and attributes
$aosContracts = BeanFactory::newBean('AOS_Contracts');
$this->assertInstanceOf('AOS_Contracts', $aosContracts);
$this->assertInstanceOf('Basic', $aosContracts);
$this->assertInstanceOf('SugarBean', $aosContracts);
$this->assertAttributeEquals('AOS_Contracts', 'module_dir', $aosContracts);
$this->assertAttributeEquals('AOS_Contracts', 'object_name', $aosContracts);
$this->assertAttributeEquals('aos_contracts', 'table_name', $aosContracts);
$this->assertAttributeEquals(true, 'new_schema', $aosContracts);
$this->assertAttributeEquals(true, 'disable_row_level_security', $aosContracts);
$this->assertAttributeEquals(true, 'importable', $aosContracts);
$this->assertTrue(isset($aosContracts->renewal_reminder_date));
}
public function testsaveAndDelete()
{
$aosContracts = BeanFactory::newBean('AOS_Contracts');
$aosContracts->name = 'test';
$aosContracts->save();
//test for record ID to verify that record is saved
$this->assertTrue(isset($aosContracts->id));
$this->assertEquals(36, strlen($aosContracts->id));
//mark the record as deleted and verify that this record cannot be retrieved anymore.
$aosContracts->mark_deleted($aosContracts->id);
$result = $aosContracts->retrieve($aosContracts->id);
$this->assertEquals(null, $result);
}
public function testCreateReminderAndCreateLinkAndDeleteCall()
{
$call = new call();
$aosContracts = BeanFactory::newBean('AOS_Contracts');
$aosContracts->name = 'test';
//test createReminder()
$aosContracts->createReminder();
//verify record ID to check that record is saved
$this->assertTrue(isset($aosContracts->call_id));
$this->assertEquals(36, strlen($aosContracts->call_id));
//verify the parent_type value set by createReminder()
$call->retrieve($aosContracts->call_id);
$this->assertAttributeEquals('AOS_Contracts', 'parent_type', $call);
//test createLink() and verify the parent_type value
$aosContracts->createLink();
$call->retrieve($aosContracts->call_id);
$this->assertAttributeEquals('Accounts', 'parent_type', $call);
//delete the call and verify that this record cannot be retrieved anymore.
$aosContracts->deleteCall();
$result = $call->retrieve($aosContracts->call_id);
$this->assertEquals(null, $result);
}
}