-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Integration tests #38
Merged
+1,892
−112
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
af25f27
Create script to download Sugar from Dev Builds community
lschaefer-sugarcrm 4dcba4d
Add PHPUnit tests for Prof M and the associated infrastructure
lschaefer-sugarcrm 7f9c771
Updating PHPUnit automation scripts based on code review
lschaefer-sugarcrm c27d7f6
Update PHPUnit tests & after save hook based on code review
lschaefer-sugarcrm 7ae12eb
Improvements to gradebook tests
lschaefer-sugarcrm 6a0b4b4
Removing Sugar PHPUnit test run
lschaefer-sugarcrm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Large diffs are not rendered by default.
Oops, something went wrong.
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"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We tend to use single quotes for strings unless using string interpolation. It's not a PSR rule, however. |
||
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Running tests on ent, pro, and ult seems overkill? The Professor M code doesn't come in different flavors. I assume you're doing this to run the core unit tests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Notes from our chat: We're going to continue running on ent, pro, and ult as this tests the install into each version. I'm going to remove the running of the Sugar provided unit tests.