Skip to content

Commit

Permalink
Update PHPUnit tests based on code review
Browse files Browse the repository at this point in the history
  • Loading branch information
lschaefer-sugarcrm committed Apr 3, 2018
1 parent 639f28b commit f47d2f8
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 14 deletions.
4 changes: 0 additions & 4 deletions package/src/custom/modules/Contacts/Students_Gradebook.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
<?php

require_once 'include/SugarQueue/SugarJobQueue.php';

if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');

/**
* Class Students_Gradebook
* Handles creating a job for the Sugar Job Queue that adds a new student to the GradebookFake app
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
<?php

namespace Sugarcrm\SugarcrmTestsUnit\modules\Schedulers\Ext\ScheduledTasks;

use Sugarcrm\SugarcrmTestsUnit\TestMockHelper;
use Sugarcrm\Sugarcrm\Util\Uuid;

require_once 'custom/Extension/modules/Schedulers/Ext/ScheduledTasks/StudentGradebookJob.php';
/**
* @coversDefaultClass \StudentGradebookJob
*/
class StudentGradebookJobTest extends \PHPUnit_Framework_TestCase
class StudentGradebookJobTest extends \PHPUnit\Framework\TestCase
{
/**
* @var a partial mock of a Student (Contact) with an id, first name, last name, and email
Expand All @@ -28,10 +31,9 @@ class StudentGradebookJobTest extends \PHPUnit_Framework_TestCase
*/
private $sgJob;

public function setup()
protected function setUp()
{
\SugarAutoLoader::load('../../../Extension/modules/Schedulers/Ext/ScheduledTasks/StudentGradebookJob.php');
parent::setup();
parent::setUp();

// Create a new Student (Contact) with an id, first name, last name, and email
$this->student = TestMockHelper::createPartialMock($this, '\\Contact', []);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class RecordManagerTest extends TestCase
{
/**
* Check that when valid params are sent to createStudentRecord, true is returned
* @covers createStudentRecord
* @covers ::createStudentRecord
*/
public function testRecordManagerValidParams(){
$rm = new RecordManager();
Expand All @@ -23,7 +23,7 @@ public function testRecordManagerValidParams(){
/**
* Check that when the email address forceerror@example.com is used as a param for createStudentRecord, an
* exception is thrown
* @covers createStudentRecord
* @covers ::createStudentRecord
*/
public function testRecordManagerForceException(){
$rm = new RecordManager();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
use Sugarcrm\SugarcrmTestsUnit\TestMockHelper;
use Sugarcrm\Sugarcrm\Util\Uuid;

require_once 'include/SugarQueue/SugarJobQueue.php';
require_once 'custom/modules/Contacts/Students_Gradebook.php';

/**
* @coversDefaultClass \Students_Gradebook
*/
class Student_GradebookTest extends \PHPUnit_Framework_TestCase
class Student_GradebookTest extends \PHPUnit\Framework\TestCase
{

/**
Expand All @@ -33,8 +33,6 @@ class Student_GradebookTest extends \PHPUnit_Framework_TestCase

protected function setUp()
{
\SugarAutoLoader::load('../../../modules/Contacts/Students_Gradebook.php');

parent::setUp();
$GLOBALS['current_user'] = $this->createPartialMock('\\User', []);
$GLOBALS['current_user']->id = Uuid::uuid1();
Expand Down

0 comments on commit f47d2f8

Please sign in to comment.