From ed604a5c267608a854652412ebe5d1cfea736231 Mon Sep 17 00:00:00 2001 From: David Pesce <davidpesce@gmail.com> Date: Sun, 11 Jun 2017 19:59:20 -0400 Subject: [PATCH] codeclimate camelcase fixes --- lib/emitter/tests/EventTest.php | 18 +++++++++--------- .../docs/examples/FeedbackSubitted.json | 2 +- lib/expander/src/Repository.php | 10 +++++----- lib/translator/src/Events/Event.php | 6 +++--- lib/translator/tests/EventTest.php | 8 ++++---- tests/TestCase.php | 4 ++-- 6 files changed, 24 insertions(+), 24 deletions(-) diff --git a/lib/emitter/tests/EventTest.php b/lib/emitter/tests/EventTest.php index ba74959..22a5136 100644 --- a/lib/emitter/tests/EventTest.php +++ b/lib/emitter/tests/EventTest.php @@ -135,10 +135,10 @@ abstract class EventTest extends PhpUnitTestCase { protected function assertValidXapiStatement($output) { $errors = Statement::createFromJson(json_encode($output))->validate(); - $errors_json = json_encode(array_map(function ($error) { + $errorsJson = json_encode(array_map(function ($error) { return (string) $error; }, $errors)); - $this->assertEmpty($errors, $errors_json); + $this->assertEmpty($errors, $errorsJson); } protected function assertInfo($input, $output) { @@ -155,11 +155,11 @@ abstract class EventTest extends PhpUnitTestCase { } protected function assertLog($input, $output) { - $actual_context = $output['context']; - $this->assertEquals($input['context_lang'], $actual_context['language']); - $this->assertEquals($input['context_platform'], $actual_context['platform']); - $this->assertArrayHasKey($input['context_ext_key'], $actual_context['extensions']); - $this->assertEquals($input['context_ext'], $actual_context['extensions'][$input['context_ext_key']]); + $actualContext = $output['context']; + $this->assertEquals($input['context_lang'], $actualContext['language']); + $this->assertEquals($input['context_platform'], $actualContext['platform']); + $this->assertArrayHasKey($input['context_ext_key'], $actualContext['extensions']); + $this->assertEquals($input['context_ext'], $actualContext['extensions'][$input['context_ext_key']]); $this->assertEquals($input['time'], $output['timestamp']); } @@ -170,9 +170,9 @@ abstract class EventTest extends PhpUnitTestCase { $this->assertEquals($input[$type.'_description'], $output['definition']['description'][$input['context_lang']]); } - protected function assertVerb($verbId, $verb_name, $output) { + protected function assertVerb($verbId, $verbName, $output) { $this->assertEquals($verbId, $output['id']); - $this->assertEquals($verb_name, $output['display']['en']); + $this->assertEquals($verbName, $output['display']['en']); } protected function assertAttempt($input, $output) { diff --git a/lib/expander/docs/examples/FeedbackSubitted.json b/lib/expander/docs/examples/FeedbackSubitted.json index 6944c74..b4e0d69 100644 --- a/lib/expander/docs/examples/FeedbackSubitted.json +++ b/lib/expander/docs/examples/FeedbackSubitted.json @@ -116,6 +116,6 @@ "type": "object" } }, - "timemodified": 1497208516 + "timemodified": 1497225541 } } \ No newline at end of file diff --git a/lib/expander/src/Repository.php b/lib/expander/src/Repository.php index 3db4639..b9c07fe 100644 --- a/lib/expander/src/Repository.php +++ b/lib/expander/src/Repository.php @@ -72,12 +72,12 @@ class Repository extends PhpObj { public function readModule($id, $type) { $model = $this->readObject($id, $type); $module = $this->readStoreRecord('modules', ['name' => $type]); - $course_module = $this->readStoreRecord('course_modules', [ + $courseModule = $this->readStoreRecord('course_modules', [ 'instance' => $id, 'module' => $module->id, 'course' => $model->course ]); - $model->url = $this->cfg->wwwroot . '/mod/'.$type.'/view.php?id=' . $course_module->id; + $model->url = $this->cfg->wwwroot . '/mod/'.$type.'/view.php?id=' . $courseModule->id; return $model; } @@ -172,12 +172,12 @@ class Repository extends PhpObj { * @param String $id * @return PhpObj */ - public function readGradeComment($grade_id, $assignment_id) { + public function readGradeComment($gradeId, $assignmentId) { $model = $this->readStoreRecord( 'assignfeedback_comments', [ - 'assignment' => $assignment_id, - 'grade' => $grade_id + 'assignment' => $assignmentId, + 'grade' => $gradeId ] ); return $model; diff --git a/lib/translator/src/Events/Event.php b/lib/translator/src/Events/Event.php index 1a97268..d09dab4 100644 --- a/lib/translator/src/Events/Event.php +++ b/lib/translator/src/Events/Event.php @@ -11,7 +11,7 @@ class Event extends PhpObj { * @return [String => Mixed] */ public function read(array $opts) { - $app_name = $opts['app']->fullname ?: 'A Moodle site'; + $appName = $opts['app']->fullname ?: 'A Moodle site'; return [[ 'user_id' => $opts['user']->id, @@ -26,8 +26,8 @@ class Event extends PhpObj { 'context_info' => $opts['info'], 'time' => date('c', $opts['event']['timecreated']), 'app_url' => $opts['app']->url, - 'app_name' => $app_name, - 'app_description' => strip_tags($opts['app']->summary) ?: $app_name, + 'app_name' => $appName, + 'app_description' => strip_tags($opts['app']->summary) ?: $appName, 'app_type' => 'http://id.tincanapi.com/activitytype/site', 'app_ext' => $opts['app'], 'sendmbox' => $opts['sendmbox'], diff --git a/lib/translator/tests/EventTest.php b/lib/translator/tests/EventTest.php index 55ae992..03734e4 100644 --- a/lib/translator/tests/EventTest.php +++ b/lib/translator/tests/EventTest.php @@ -128,23 +128,23 @@ abstract class EventTest extends PhpUnitTestCase { protected function assertApp($input, $output, $type) { $extKey = 'http://lrs.learninglocker.net/define/extensions/moodle_course'; - $app_type = 'http://id.tincanapi.com/activitytype/site'; + $appType = 'http://id.tincanapi.com/activitytype/site'; $this->assertEquals($input->lang, $output['context_lang']); $this->assertEquals($input->url, $output[$type.'_url']); $this->assertEquals($input->fullname, $output[$type.'_name']); $this->assertEquals(strip_tags($input->summary), $output[$type.'_description']); - $this->assertEquals($app_type, $output[$type.'_type']); + $this->assertEquals($appType, $output[$type.'_type']); $this->assertEquals($input, $output[$type.'_ext']); $this->assertEquals($extKey, $output[$type.'_ext_key']); } protected function assertSource($input, $output, $type) { - $app_type = 'http://id.tincanapi.com/activitytype/source'; + $appType = 'http://id.tincanapi.com/activitytype/source'; $this->assertEquals($input->lang, $output['context_lang']); $this->assertEquals($input->url, $output[$type.'_url']); $this->assertEquals($input->fullname, $output[$type.'_name']); $this->assertEquals(strip_tags($input->summary), $output[$type.'_description']); - $this->assertEquals($app_type, $output[$type.'_type']); + $this->assertEquals($appType, $output[$type.'_type']); } private function assertEvent($input, $output) { diff --git a/tests/TestCase.php b/tests/TestCase.php index 6aa70bb..655c6f2 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -55,10 +55,10 @@ abstract class TestCase extends PhpUnitTestCase { protected function assertValidXapiStatement($output) { $errors = LockerStatement::createFromJson(json_encode($output))->validate(); - $errors_json = json_encode(array_map(function ($error) { + $errorsJson = json_encode(array_map(function ($error) { return (string) $error; }, $errors)); - $this->assertEmpty($errors, $errors_json); + $this->assertEmpty($errors, $errorsJson); } protected function constructInput() { -- GitLab