0
0
Fork 0
mirror of https://github.com/salesagility/SuiteCRM.git synced 2025-02-22 21:18:38 +00:00
salesagility_SuiteCRM/tests/unit/phpunit/include/MVC/View/views/view.detailTest.php
j.dang c8d74861b2 Replace explicit bean instantiations in files 71 - 80
- File: '... /install/performSetup.php'

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

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

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

- File: '... /install/UserDemoData.php'

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

- File: '... /tests/unit/phpunit/data/SugarBeanTest.php'

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

   - Replaced 104 occurrence(s) of 'new Contact()'

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

- File: '... /tests/unit/phpunit/include/SubPanel/SubPanelTest.php'

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

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

- File: '... /tests/unit/phpunit/include/MVC/Controller/SugarControllerTest.php'

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

- File: '... /tests/unit/phpunit/include/MVC/View/SugarViewTest.php'

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

- File: '... /tests/unit/phpunit/include/MVC/View/views/view.listTest.php'

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

- File: '... /tests/unit/phpunit/include/MVC/View/views/view.htmlTest.php'

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

- File: '... /tests/unit/phpunit/include/MVC/View/views/view.detailTest.php'

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

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

- File: '... /tests/unit/phpunit/include/MVC/View/views/view.editTest.php'

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

   - Replaced 3 occurrence(s) of 'new User()'
2020-01-22 13:50:53 +00:00

66 lines
2.1 KiB
PHP

<?php
use SuiteCRM\Test\SuitePHPUnitFrameworkTestCase;
class ViewDetailTest extends SuitePHPUnitFrameworkTestCase
{
public function setUp()
{
parent::setUp();
global $current_user;
get_sugar_config_defaults();
$current_user = BeanFactory::newBean('Users');
}
public function tearDown()
{
parent::tearDown();
}
public function testViewDetail()
{
// Execute the constructor and check for the Object type and type attribute
$view = new ViewDetail();
$this->assertInstanceOf('ViewDetail', $view);
$this->assertInstanceOf('SugarView', $view);
$this->assertAttributeEquals('detail', 'type', $view);
}
public function testpreDisplay()
{
//execute the method with required attributes preset, it will initialize the dv(detail view) attribute.
$view = new ViewDetail();
$view->module = 'Users';
$view->bean = BeanFactory::newBean('Users');
$view->ss = new Sugar_Smarty();
$view->preDisplay();
$this->assertInstanceOf('DetailView2', $view->dv);
$this->asserttrue(is_array($view->dv->defs));
//execute the method again for a different module with required attributes preset, it will initialize the dv(detail view) attribute.
$view = new ViewDetail();
$view->module = 'Meetings';
$view->bean = BeanFactory::newBean('Meetings');
$view->ss = new Sugar_Smarty();
$view->preDisplay();
$this->assertInstanceOf('DetailView2', $view->dv);
$this->asserttrue(is_array($view->dv->defs));
}
public function testdisplay()
{
//execute the method with essential parameters set. it should return some html.
$view = new ViewDetail();
$view->module = 'Users';
$view->bean = BeanFactory::newBean('Users');
$view->bean->id = 1;
$view->ss = new Sugar_Smarty();
$view->preDisplay();
ob_start();
$view->display();
$renderedContent = ob_get_contents();
ob_end_clean();
$this->assertGreaterThan(0, strlen($renderedContent));
}
}