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/Audit/AuditTest.php
j.dang 22852537fc Replace explicit bean instantiations in files 131 - 140
- File: '... /tests/unit/phpunit/modules/Leads/LeadTest.php'

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

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

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

- File: '... /tests/unit/phpunit/modules/AOP_Case_Events/AOP_Case_EventsTest.php'

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

- File: '... /tests/unit/phpunit/modules/AOS_Products/AOS_ProductsTest.php'

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

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

- File: '... /tests/unit/phpunit/modules/AOD_Index/AOD_IndexTest.php'

   - Replaced 10 occurrence(s) of 'new AOD_Index()'

- File: '... /tests/unit/phpunit/modules/Contacts/ContactTest.php'

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

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

- File: '... /tests/unit/phpunit/modules/SecurityGroups/SecurityGroupTest.php'

   - Replaced 6 occurrence(s) of 'new Account()'

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

   - Replaced 16 occurrence(s) of 'new SecurityGroup()'

- File: '... /tests/unit/phpunit/modules/AM_ProjectTemplates/AM_ProjectTemplatesTest.php'

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

- File: '... /tests/unit/phpunit/modules/jjwg_Areas/jjwg_AreasTest.php'

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

- File: '... /tests/unit/phpunit/modules/AOR_Charts/AOR_ChartTest.php'

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

   - Replaced 8 occurrence(s) of 'new AOR_Chart()'

- File: '... /tests/unit/phpunit/modules/Audit/AuditTest.php'

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

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

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

151 lines
4.8 KiB
PHP

<?php
use SuiteCRM\Test\SuitePHPUnitFrameworkTestCase;
require_once 'modules/Audit/Audit.php';
class AuditTest extends SuitePHPUnitFrameworkTestCase
{
public function setUp()
{
parent::setUp();
global $current_user;
get_sugar_config_defaults();
$current_user = BeanFactory::newBean('Users');
}
public function testAudit()
{
// Execute the constructor and check for the Object type and attributes
$audit = BeanFactory::newBean('Audit');
$this->assertInstanceOf('Audit', $audit);
$this->assertInstanceOf('SugarBean', $audit);
$this->assertAttributeEquals('Audit', 'module_dir', $audit);
$this->assertAttributeEquals('Audit', 'object_name', $audit);
}
public function testget_summary_text()
{
$audit = BeanFactory::newBean('Audit');
//test without setting name
$this->assertEquals(null, $audit->get_summary_text());
//test with name set
$audit->name = 'test';
$this->assertEquals('test', $audit->get_summary_text());
}
public function testcreate_export_query()
{
$audit = BeanFactory::newBean('Audit');
// Execute the method and test that it works and doesn't throw an exception.
try {
$audit->create_export_query('', '');
$this->assertTrue(true);
} catch (Exception $e) {
$this->fail($e->getMessage() . "\nTrace:\n" . $e->getTraceAsString());
}
$this->markTestIncomplete('method has no implementation');
}
public function testfill_in_additional_list_fields()
{
$audit = BeanFactory::newBean('Audit');
// Execute the method and test that it works and doesn't throw an exception.
try {
$audit->fill_in_additional_list_fields();
$this->assertTrue(true);
} catch (Exception $e) {
$this->fail($e->getMessage() . "\nTrace:\n" . $e->getTraceAsString());
}
$this->markTestIncomplete('method has no implementation');
}
public function testfill_in_additional_detail_fields()
{
$audit = BeanFactory::newBean('Audit');
// Execute the method and test that it works and doesn't throw an exception.
try {
$audit->fill_in_additional_detail_fields();
$this->assertTrue(true);
} catch (Exception $e) {
$this->fail($e->getMessage() . "\nTrace:\n" . $e->getTraceAsString());
}
$this->markTestIncomplete('method has no implementation');
}
public function testfill_in_additional_parent_fields()
{
$audit = BeanFactory::newBean('Audit');
// Execute the method and test that it works and doesn't throw an exception.
try {
$audit->fill_in_additional_parent_fields();
$this->assertTrue(true);
} catch (Exception $e) {
$this->fail($e->getMessage() . "\nTrace:\n" . $e->getTraceAsString());
}
$this->markTestIncomplete('method has no implementation');
}
public function testget_list_view_data()
{
$audit = BeanFactory::newBean('Audit');
// Execute the method and test that it works and doesn't throw an exception.
try {
$audit->get_list_view_data();
$this->assertTrue(true);
} catch (Exception $e) {
$this->fail($e->getMessage() . "\nTrace:\n" . $e->getTraceAsString());
}
$this->markTestIncomplete('method has no implementation');
}
public function testget_audit_link()
{
$audit = BeanFactory::newBean('Audit');
// Execute the method and test that it works and doesn't throw an exception.
try {
$audit->get_audit_link();
$this->assertTrue(true);
} catch (Exception $e) {
$this->fail($e->getMessage() . "\nTrace:\n" . $e->getTraceAsString());
}
$this->markTestIncomplete('method has no implementation');
}
public function testget_audit_list()
{
global $focus;
$focus = BeanFactory::newBean('Accounts'); //use audit enabbled module object
$audit = BeanFactory::newBean('Audit');
//execute the method and verify that it returns an array
$result = $audit->get_audit_list();
$this->assertTrue(is_array($result));
}
public function testgetAssociatedFieldName()
{
global $focus;
$focus = BeanFactory::newBean('Accounts'); //use audit enabbled module object
$audit = BeanFactory::newBean('Audit');
//test with name field
$result = $audit->getAssociatedFieldName('name', '1');
$this->assertEquals('1', $result);
//test with parent_id field
$result = $audit->getAssociatedFieldName('parent_id', '1');
$this->assertEquals(null, $result);
}
}