Skip to content

Commit

Permalink
Merge pull request #85 from sugarcrm/issue-84
Browse files Browse the repository at this point in the history
Fixes #84: Fix PHPUnit tests
  • Loading branch information
mmarum-sugarcrm authored Jul 13, 2018
2 parents 2362a8f + e40a790 commit 06ad7c8
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@

use Sugarcrm\SugarcrmTestsUnit\TestMockHelper;

require_once 'custom/modules/Campaigns/clients/base/api/OnlineApplicationsAPI.php';

/**
* @coversDefaultClass \OnlineApplicationsAPI
*/
class OnlineApplicationsAPI extends \PHPUnit\Framework\TestCase
class OnlineApplicationsAPITest extends \PHPUnit\Framework\TestCase
{

/**
Expand All @@ -28,8 +30,7 @@ protected function setUp()

$this->campaignBean = $this->createMock('SugarBean');

$this->api = TestMockHelper::createPartialMock($this,
'\\Sugarcrm\\Sugarcrm\\custom\\application_campaign\\ApplicationCampaignManager',
$this->api = TestMockHelper::createPartialMock($this, 'OnlineApplicationsAPI',
['getSugarQuery', 'getNewCampaignBean']);
$this->api->method('getSugarQuery')->willReturn($this->sugarQuery);
$this->api->method('getNewCampaignBean')->willReturn($this->campaignBean);
Expand All @@ -51,7 +52,7 @@ public function testGetOnlineApplicationsCampaignIdWithResults()
$this->sugarQuery->method('execute')->willReturn($this->queryResults);

$this->sugarQuery->expects($this->once())->method('execute');
$this->assertEquals($this->campaignId, $this->api->getOnlineApplicationsCampaignId());
$this->assertEquals(array('id' => $this->campaignId), $this->api->getOnlineApplicationsCampaignId());
}

/**
Expand Down

0 comments on commit 06ad7c8

Please sign in to comment.