-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #38 from sugarcrm/integration-tests
Integration tests
- Loading branch information
Showing
43 changed files
with
1,892 additions
and
112 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 0 additions & 22 deletions
22
...e/src/custom/Extension/modules/Schedulers/Ext/ScheduledTasks/AddStudentToGradebookJob.php
This file was deleted.
Oops, something went wrong.
73 changes: 73 additions & 0 deletions
73
package/src/custom/Extension/modules/Schedulers/Ext/ScheduledTasks/StudentGradebookJob.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
<?php | ||
|
||
use Sugarcrm\Sugarcrm\custom\gradebook_fake\RecordManager; | ||
|
||
class StudentGradebookJob implements RunnableSchedulerJob | ||
{ | ||
|
||
/** | ||
* @var SchedulersJob | ||
*/ | ||
protected $job; | ||
/** | ||
* @param SchedulersJob $job | ||
*/ | ||
public function setJob(SchedulersJob $job) | ||
{ | ||
$this->job = $job; | ||
} | ||
|
||
/** | ||
* This function defines the job that adds a new student to the GradebookFake app | ||
* @param string $data The id for the new Student (contact) record | ||
* @return bool true if a record was successfully created in the GradebookFake app | ||
*/ | ||
public function run($data) | ||
{ | ||
if (!empty($data)) { | ||
$bean = $this->getContactBean($data); | ||
|
||
try { | ||
//Call the external GradebookFake app to create a new record in it | ||
$rm = $this->getRecordManager(); | ||
$success = $rm->createStudentRecord($bean->emailAddress->getPrimaryAddress($bean), $bean->first_name, | ||
$bean->last_name); | ||
if ($success) { | ||
$this->job->succeedJob(); | ||
return true; | ||
} else { | ||
$this->job->failJob("Record not successfully created in GradebookFake"); | ||
return false; | ||
} | ||
} catch (Exception $e) { | ||
$this->job->failJob($e->getMessage()); | ||
|
||
return false; | ||
} | ||
|
||
} | ||
|
||
$this->job->failJob("Job had no data"); | ||
return false; | ||
} | ||
|
||
/** | ||
* Get the Contact (Student) bean for the given id | ||
* @param $id The id for which you want to retrieve a Contact (Student) bean | ||
* @return null|SugarBean | ||
*/ | ||
protected function getContactBean($id) | ||
{ | ||
return BeanFactory::retrieveBean('Contacts', $id); | ||
} | ||
|
||
/** | ||
* Get the Record Manager for the GradebookFake app | ||
* @return RecordManager The Record Manager for the GradebookFake app | ||
*/ | ||
protected function getRecordManager() | ||
{ | ||
return new RecordManager(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.