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/Releases/ReleaseTest.php
j.dang 52362db08b Replace explicit bean instantiations in files 121 - 130
- File: '... /tests/unit/phpunit/modules/AOS_Quotes/AOS_QuotesTest.php'

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

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

- File: '... /tests/unit/phpunit/modules/AOW_Processed/AOW_ProcessedTest.php'

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

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

- File: '... /tests/unit/phpunit/modules/Releases/ReleaseTest.php'

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

- File: '... /tests/unit/phpunit/modules/Administration/AdministrationTest.php'

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

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

- File: '... /tests/unit/phpunit/modules/EmailText/EmailTextTest.php'

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

- File: '... /tests/unit/phpunit/modules/Prospects/ProspectTest.php'

   - Replaced 9 occurrence(s) of 'new Prospect()'

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

- File: '... /tests/unit/phpunit/modules/InboundEmail/InboundEmailTest.php'

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

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

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

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

   - Replaced 154 occurrence(s) of 'new InboundEmail()'

- File: '... /tests/unit/phpunit/modules/vCals/vCalTest.php'

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

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

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

- File: '... /tests/unit/phpunit/modules/AOS_Products_Quotes/AOS_Products_QuotesTest.php'

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

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

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

- File: '... /tests/unit/phpunit/modules/AOK_KnowledgeBase/AOK_KnowledgeBaseTest.php'

   - Replaced 1 occurrence(s) of 'new AOK_KnowledgeBase()'
2020-01-22 13:50:59 +00:00

106 lines
3.2 KiB
PHP

<?php
use SuiteCRM\Test\SuitePHPUnitFrameworkTestCase;
class ReleaseTest extends SuitePHPUnitFrameworkTestCase
{
public function testRelease()
{
// Execute the constructor and check for the Object type and attributes
$release = BeanFactory::newBean('Releases');
$this->assertInstanceOf('Release', $release);
$this->assertInstanceOf('SugarBean', $release);
$this->assertAttributeEquals('releases', 'table_name', $release);
$this->assertAttributeEquals('Releases', 'module_dir', $release);
$this->assertAttributeEquals('Release', 'object_name', $release);
$this->assertAttributeEquals(true, 'new_schema', $release);
}
public function testget_summary_text()
{
$release = BeanFactory::newBean('Releases');
//test without setting name
$this->assertEquals(null, $release->get_summary_text());
//test with name set
$release->name = 'test';
$this->assertEquals('test', $release->get_summary_text());
}
public function testget_releases()
{
$release = BeanFactory::newBean('Releases');
//test with default params
$result = $release->get_releases();
$this->assertTrue(is_array($result));
//test with custom params
$result = $release->get_releases(true, 'Hidden', 'name is not null');
$this->assertTrue(is_array($result));
}
public function testfill_in_additional_list_fields()
{
$release = BeanFactory::newBean('Releases');
// Execute the method and test that it works and doesn't throw an exception.
try {
$release->fill_in_additional_list_fields();
$this->assertTrue(true);
} catch (Exception $e) {
$this->fail($e->getMessage() . "\nTrace:\n" . $e->getTraceAsString());
}
}
public function testfill_in_additional_detail_fields()
{
$release = BeanFactory::newBean('Releases');
// Execute the method and test that it works and doesn't throw an exception.
try {
$release->fill_in_additional_detail_fields();
$this->assertTrue(true);
} catch (Exception $e) {
$this->fail($e->getMessage() . "\nTrace:\n" . $e->getTraceAsString());
}
}
public function testget_list_view_data()
{
$release = BeanFactory::newBean('Releases');
$release->name = 'test';
$release->status = 'Hidden';
$expected = array(
'NAME' => 'test',
'STATUS' => 'Hidden',
'ENCODED_NAME' => 'test',
'ENCODED_STATUS' => null,
);
$actual = $release->get_list_view_data();
$this->assertSame($expected, $actual);
}
public function testbuild_generic_where_clause()
{
$release = BeanFactory::newBean('Releases');
//test with empty string params
$expected = "name like '%'";
$actual = $release->build_generic_where_clause('');
$this->assertSame($expected, $actual);
//test with valid string params
$expected = "name like 'test%'";
$actual = $release->build_generic_where_clause('test');
$this->assertSame($expected, $actual);
}
}