0
0
Fork 0
mirror of https://github.com/salesagility/SuiteCRM.git synced 2025-02-11 16:58:54 +00:00
salesagility_SuiteCRM/tests/unit/phpunit/modules/AOS_Invoices/AOS_InvoicesTest.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

49 lines
1.7 KiB
PHP

<?php
use SuiteCRM\Test\SuitePHPUnitFrameworkTestCase;
class AOS_InvoicesTest extends SuitePHPUnitFrameworkTestCase
{
protected function setUp(): void
{
parent::setUp();
global $current_user;
get_sugar_config_defaults();
$current_user = BeanFactory::newBean('Users');
}
public function testAOS_Invoices(): void
{
// Execute the constructor and check for the Object type and attributes
$aosInvoices = BeanFactory::newBean('AOS_Invoices');
self::assertInstanceOf('AOS_Invoices', $aosInvoices);
self::assertInstanceOf('Basic', $aosInvoices);
self::assertInstanceOf('SugarBean', $aosInvoices);
self::assertEquals('AOS_Invoices', $aosInvoices->module_dir);
self::assertEquals('AOS_Invoices', $aosInvoices->object_name);
self::assertEquals('aos_invoices', $aosInvoices->table_name);
self::assertEquals(true, $aosInvoices->new_schema);
self::assertEquals(true, $aosInvoices->disable_row_level_security);
self::assertEquals(true, $aosInvoices->importable);
}
public function testSaveAndMark_deleted(): void
{
$aosInvoices = BeanFactory::newBean('AOS_Invoices');
$aosInvoices->name = 'test';
$aosInvoices->save();
//test for record ID to verify that record is saved
self::assertTrue(isset($aosInvoices->id));
self::assertEquals(36, strlen($aosInvoices->id));
self::assertGreaterThan(0, $aosInvoices->number);
//mark the record as deleted and verify that this record cannot be retrieved anymore.
$aosInvoices->mark_deleted($aosInvoices->id);
$result = $aosInvoices->retrieve($aosInvoices->id);
self::assertEquals(null, $result);
}
}