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/Groups/GroupTest.php
j.dang cfa1f7cc28 Replace explicit bean instantiations in files 151 - 160
- File: '... /tests/unit/phpunit/modules/Groups/GroupTest.php'

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

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

- File: '... /tests/unit/phpunit/modules/AOS_Product_Categories/AOS_Product_CategoriesTest.php'

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

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

- File: '... /tests/unit/phpunit/modules/AOD_IndexEvent/AOD_IndexEventTest.php'

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

- File: '... /tests/unit/phpunit/modules/AOP_Case_Updates/AOP_Case_UpdatesTest.php'

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

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

- File: '... /tests/unit/phpunit/modules/Campaigns/CampaignTest.php'

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

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

   - Replaced 20 occurrence(s) of 'new Campaign()'

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

- File: '... /tests/unit/phpunit/modules/DocumentRevisions/DocumentRevisionTest.php'

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

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

- File: '... /tests/unit/phpunit/modules/AOW_WorkFlow/AOW_WorkFlowTest.php'

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

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

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

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

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

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

- File: '... /tests/unit/phpunit/modules/EmailAddresses/EmailAddressTest.php'

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

- File: '... /tests/unit/phpunit/modules/AOW_Conditions/AOW_ConditionTest.php'

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

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

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

- File: '... /tests/unit/phpunit/modules/Calls/CallTest.php'

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

   - Replaced 2 occurrence(s) of 'new User()'
2020-01-22 13:51:02 +00:00

58 lines
2 KiB
PHP

<?php
use SuiteCRM\Test\SuitePHPUnitFrameworkTestCase;
class GroupTest extends SuitePHPUnitFrameworkTestCase
{
public function setUp()
{
parent::setUp();
global $current_user;
$current_user = BeanFactory::newBean('Users');
get_sugar_config_defaults();
}
public function testGroup()
{
//execute the constructor and check for the Object type and attributes
$group = BeanFactory::newBean('Groups');
$this->assertInstanceOf('Group', $group);
$this->assertInstanceOf('User', $group);
$this->assertInstanceOf('SugarBean', $group);
$this->assertAttributeEquals('Group', 'status', $group);
$this->assertAttributeEquals('', 'password', $group);
$this->assertAttributeEquals(false, 'importable', $group);
}
public function testmark_deleted()
{
self::markTestIncomplete('environment dependency (php7: Incorrect state hash: Hash doesn\'t match at key "database::users".)');
$group = BeanFactory::newBean('Groups');
// Execute the method and test that it works and doesn't throw an exception.
try {
$group->mark_deleted('');
$this->assertTrue(true);
} catch (Exception $e) {
$this->fail($e->getMessage() . "\nTrace:\n" . $e->getTraceAsString());
}
}
public function testcreate_export_query()
{
$group = BeanFactory::newBean('Groups');
//test with empty string params
$expected = 'SELECT users.* FROM users WHERE users.deleted = 0 ORDER BY users.user_name';
$actual = $group->create_export_query('', '');
$this->assertSame($expected, $actual);
//test with valid string params
$expected = 'SELECT users.* FROM users WHERE users.user_name="" AND users.deleted = 0 ORDER BY users.id';
$actual = $group->create_export_query('users.id', 'users.user_name=""');
$this->assertSame($expected, $actual);
}
}