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.vcardTest.php
j.dang 47c18d731c Replace explicit bean instantiations in files 81 - 90
- File: '... /tests/unit/phpunit/include/MVC/View/views/view.quickTest.php'

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

35 lines
1.2 KiB
PHP

<?php
use SuiteCRM\Test\SuitePHPUnitFrameworkTestCase;
class ViewVcardTest extends SuitePHPUnitFrameworkTestCase
{
public function setUp()
{
parent::setUp();
global $current_user;
get_sugar_config_defaults();
$current_user = BeanFactory::newBean('Users');
}
public function testdisplay()
{
//execute the method with required child objects preset and check for the Object type and type attribute
$view = new ViewVcard();
$view->module = 'Contacts';
$view->bean = BeanFactory::newBean('Contacts');
$this->expectOutputRegex('/.*BEGIN:VCARD.*/');
//execute the method and test if it works and does not throws an exception other than headers output exception.
try {
$view->display();
} catch (Exception $e) {
$msg = $e->getMessage();
$this->assertStringStartsWith('Cannot modify header information', $msg, $msg . "\nTrace:\n" . $e->getTraceAsString());
}
$this->assertInstanceOf('ViewVcard', $view);
$this->assertInstanceOf('SugarView', $view);
$this->assertAttributeEquals('detail', 'type', $view);
}
}