forked from extern/egroupware
Some simplifications in how to make the mock Etemplate objects from Sebastian
This commit is contained in:
parent
17f5461f6c
commit
a4c2e841e1
@ -17,7 +17,7 @@ namespace EGroupware\Infolog;
|
|||||||
|
|
||||||
require_once realpath(__DIR__.'/../../api/tests/AppTest.php'); // Application test base
|
require_once realpath(__DIR__.'/../../api/tests/AppTest.php'); // Application test base
|
||||||
|
|
||||||
use Egroupware\Api\Contacts;
|
use Egroupware\Api\Etemplate;
|
||||||
|
|
||||||
class ContactTest extends \EGroupware\Api\AppTest
|
class ContactTest extends \EGroupware\Api\AppTest
|
||||||
{
|
{
|
||||||
@ -32,10 +32,8 @@ class ContactTest extends \EGroupware\Api\AppTest
|
|||||||
{
|
{
|
||||||
$this->ui = new \infolog_ui();
|
$this->ui = new \infolog_ui();
|
||||||
|
|
||||||
$this->ui->tmpl = $this->getMockBuilder('\\Egroupware\\Api\\Etemplate')
|
$this->ui->tmpl = $this->createPartialMock(Etemplate::class, array('exec', 'read'));
|
||||||
->disableOriginalConstructor()
|
|
||||||
->setMethods(array('exec', 'read'))
|
|
||||||
->getMock($this->ui);
|
|
||||||
$this->bo = $this->ui->bo;
|
$this->bo = $this->ui->bo;
|
||||||
|
|
||||||
$this->mockTracking($this->bo, 'infolog_tracking');
|
$this->mockTracking($this->bo, 'infolog_tracking');
|
||||||
|
@ -6,6 +6,7 @@ namespace EGroupware\Infolog;
|
|||||||
require_once realpath(__DIR__.'/../../api/tests/AppTest.php'); // Application test base
|
require_once realpath(__DIR__.'/../../api/tests/AppTest.php'); // Application test base
|
||||||
|
|
||||||
use Egroupware\Api;
|
use Egroupware\Api;
|
||||||
|
use Egroupware\Api\Etemplate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test setting a project manager project on an infolog entry
|
* Test setting a project manager project on an infolog entry
|
||||||
@ -36,11 +37,7 @@ class SetProjectManagerTest extends \EGroupware\Api\AppTest
|
|||||||
{
|
{
|
||||||
$this->ui = new \infolog_ui();
|
$this->ui = new \infolog_ui();
|
||||||
|
|
||||||
|
$this->ui->tmpl = $this->createPartialMock(Etemplate::class, array('exec', 'read'));
|
||||||
$this->ui->tmpl = $this->getMockBuilder('\\Egroupware\\Api\\Etemplate')
|
|
||||||
->disableOriginalConstructor()
|
|
||||||
->setMethods(array('exec', 'read'))
|
|
||||||
->getMock($this->ui);
|
|
||||||
|
|
||||||
$this->bo = $this->ui->bo;
|
$this->bo = $this->ui->bo;
|
||||||
$this->pm_bo = new \projectmanager_bo();
|
$this->pm_bo = new \projectmanager_bo();
|
||||||
@ -125,12 +122,8 @@ class SetProjectManagerTest extends \EGroupware\Api\AppTest
|
|||||||
$info = $this->getTestInfolog();
|
$info = $this->getTestInfolog();
|
||||||
|
|
||||||
$this->info_id = $this->bo->write($info);
|
$this->info_id = $this->bo->write($info);
|
||||||
$this->assertThat($this->info_id,
|
$this->assertInternalType('integer', $this->info_id);
|
||||||
$this->logicalAnd(
|
$this->assertGreaterThan(0, $this->info_id);
|
||||||
$this->isType('integer'),
|
|
||||||
$this->greaterThan(0)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
// Force links to run notification now so we get valid testing - it
|
// Force links to run notification now so we get valid testing - it
|
||||||
// usually waits until Egw::on_shutdown();
|
// usually waits until Egw::on_shutdown();
|
||||||
|
Loading…
Reference in New Issue
Block a user