90 lines
2.4 KiB
PHP
90 lines
2.4 KiB
PHP
<?php
|
|
|
|
namespace Tests\unit\workflow\engine\src\ProcessMaker\Model;
|
|
|
|
use ProcessMaker\Model\EmailServerModel;
|
|
use Tests\TestCase;
|
|
|
|
class EmailServerModelTest extends TestCase
|
|
{
|
|
/**
|
|
* Call the setUp parent method
|
|
*/
|
|
public function setUp()
|
|
{
|
|
parent::setUp(); // TODO: Change the autogenerated stub
|
|
}
|
|
|
|
/**
|
|
* Call the tearDown parent method
|
|
*/
|
|
public function tearDown()
|
|
{
|
|
parent::tearDown(); // TODO: Change the autogenerated stub
|
|
}
|
|
|
|
/**
|
|
* Test the getEmailServer method
|
|
*
|
|
* @covers \ProcessMaker\Model\EmailServerModel::getEmailServer()
|
|
* @test
|
|
*/
|
|
public function it_should_test_the_get_email_server_method()
|
|
{
|
|
//Create the EmailServerModel factory
|
|
$emailServer = factory(EmailServerModel::class)->create();
|
|
|
|
//Create the EmailServerModel object
|
|
$email = new EmailServerModel();
|
|
//Call the getEmailServer method
|
|
$res = $email->getEmailServer($emailServer->MESS_UID);
|
|
|
|
//Assert the result es not empty
|
|
$this->assertNotEmpty($res);
|
|
//Assert the result is the one looked for
|
|
$this->assertEquals($res['MESS_UID'], $emailServer->MESS_UID);
|
|
}
|
|
|
|
/**
|
|
* Test the getEmailServer method with an empty result
|
|
*
|
|
* @covers \ProcessMaker\Model\EmailServerModel::getEmailServer()
|
|
* @test
|
|
*/
|
|
public function it_should_test_the_get_email_server_method_with_an_empty_result()
|
|
{
|
|
//Create the EmailServerModel factory
|
|
$emailServer = factory(EmailServerModel::class)->create();
|
|
|
|
//Create the EmailServerModel object
|
|
$email = new EmailServerModel();
|
|
//Call the getEmailServer method
|
|
$res = $email->getEmailServer('');
|
|
|
|
//Assert the result is empty
|
|
$this->assertEmpty($res);
|
|
}
|
|
|
|
/**
|
|
* Test the getEmailServerDefault method
|
|
*
|
|
* @covers \ProcessMaker\Model\EmailServerModel::getEmailServerDefault()
|
|
* @test
|
|
*/
|
|
public function it_should_test_the_get_email_server_default()
|
|
{
|
|
//Create the EmailServer factory
|
|
$emailServer = factory(EmailServerModel::class)->create([
|
|
'MESS_DEFAULT' => 1
|
|
]);
|
|
|
|
//Create the EmailServerModel object
|
|
$email = new EmailServerModel();
|
|
//Call the getEmailServerDefault method
|
|
$res = $email->getEmailServerDefault();
|
|
|
|
//Assert the result es not empty
|
|
$this->assertNotEmpty($res);
|
|
}
|
|
}
|