0
0
mirror of https://github.com/salesagility/SuiteCRM.git synced 2024-11-26 01:17:57 +00:00
salesagility_SuiteCRM/tests/unit/phpunit/modules/Favorites/FavoritesTest.php
Dillon-Brown 26aab7535d Move test namespaces into autoload-dev
Signed-off-by: Dillon-Brown <dillon.brown@salesagility.com>
2021-09-08 16:49:16 +01:00

54 lines
1.7 KiB
PHP

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