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/Favorites/FavoritesTest.php
j.dang 4a381d962a Replace explicit bean instantiations in files 101 - 110
- File: '... /tests/unit/phpunit/modules/ACLActions/ACLActionTest.php'

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

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

- File: '... /tests/unit/phpunit/modules/ProjectTask/ProjectTaskTest.php'

   - Replaced 19 occurrence(s) of 'new ProjectTask()'

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

- File: '... /tests/unit/phpunit/modules/Alerts/AlertTest.php'

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

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

- File: '... /tests/unit/phpunit/modules/ACLRoles/ACLRoleTest.php'

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

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

- File: '... /tests/unit/phpunit/modules/jjwg_Markers/jjwg_MarkersTest.php'

   - Replaced 5 occurrence(s) of 'new jjwg_Markers()'

- File: '... /tests/unit/phpunit/modules/Tasks/TaskTest.php'

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

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

- File: '... /tests/unit/phpunit/modules/CampaignLog/CampaignLogTest.php'

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

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

- File: '... /tests/unit/phpunit/modules/UserPreferences/UserPreferenceTest.php'

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

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

- File: '... /tests/unit/phpunit/modules/Favorites/FavoritesTest.php'

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

- File: '... /tests/unit/phpunit/modules/AOR_Scheduled_Reports/AOR_Scheduled_ReportsTest.php'

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

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

   - Replaced 5 occurrence(s) of 'new AOR_Scheduled_Reports()'
2020-01-22 13:50:56 +00:00

55 lines
1.8 KiB
PHP

<?php
use SuiteCRM\Test\SuitePHPUnitFrameworkTestCase;
class FavoritesTest extends SuitePHPUnitFrameworkTestCase
{
public function testFavorites()
{
// Execute the constructor and check for the Object type and attributes
$favorites = BeanFactory::newBean('Favorites');
$this->assertInstanceOf('Favorites', $favorites);
$this->assertInstanceOf('Basic', $favorites);
$this->assertInstanceOf('SugarBean', $favorites);
$this->assertAttributeEquals('Favorites', 'module_dir', $favorites);
$this->assertAttributeEquals('Favorites', 'object_name', $favorites);
$this->assertAttributeEquals('favorites', 'table_name', $favorites);
$this->assertAttributeEquals(true, 'new_schema', $favorites);
}
public function testdeleteFavorite()
{
$favorites = BeanFactory::newBean('Favorites');
//testing with an empty ID
$result = $favorites->deleteFavorite('');
$this->assertEquals(false, $result);
}
public function testgetFavoriteID()
{
$favorites = BeanFactory::newBean('Favorites');
//test with blank string parameters
$result = $favorites->getFavoriteID('', '');
$this->assertEquals(false, $result);
//test with string parameters
$result = $favorites->getFavoriteID('Accounts', '1');
$this->assertEquals(false, $result);
}
public function testgetCurrentUserSidebarFavorites()
{
$favorites = BeanFactory::newBean('Favorites');
//test with empty string parameter
$result = $favorites->getCurrentUserSidebarFavorites();
$this->assertTrue(is_array($result));
//test with string
$result = $favorites->getCurrentUserSidebarFavorites('1');
$this->assertTrue(is_array($result));
}
}