FMCorz / moodle-block_xp

A gamification plugin for Moodle allowing students to gain experience points and level up.
https://levelup.plus/?ref=github
150 stars 41 forks source link

Missing lang string: privacy:metadata:log:lvl #86

Closed polothy closed 6 years ago

polothy commented 6 years ago

The test error:

provider_testcase::test_metadata_provider with data set "block_xp" ('block_xp', 'block_xp\privacy\provider')
Expectation failed, debugging() was triggered.
Debugging: Invalid get_string() identifier: 'privacy:metadata:log:lvl' or component 'block_xp'. Perhaps you are missing $string['privacy:metadata:log:lvl'] = ''; in /blocks/xp/lang/en/block_xp.php?
* line 357 of /lib/classes/string_manager_standard.php: call to debugging()
* line 7126 of /lib/moodlelib.php: call to core_string_manager_standard->get_string()
* line 162 of /privacy/tests/provider_test.php: call to get_string()
* line ? of unknownfile: call to provider_testcase->test_metadata_provider()
* line 1071 of /vendor/phpunit/phpunit/src/Framework/TestCase.php: call to ReflectionMethod->invokeArgs()
* line 939 of /vendor/phpunit/phpunit/src/Framework/TestCase.php: call to PHPUnit\Framework\TestCase->runTest()
* line 91 of /lib/phpunit/classes/advanced_testcase.php: call to PHPUnit\Framework\TestCase->runBare()
* line 698 of /vendor/phpunit/phpunit/src/Framework/TestResult.php: call to advanced_testcase->runBare()
* line 894 of /vendor/phpunit/phpunit/src/Framework/TestCase.php: call to PHPUnit\Framework\TestResult->run()
* line 755 of /vendor/phpunit/phpunit/src/Framework/TestSuite.php: call to PHPUnit\Framework\TestCase->run()
* line 755 of /vendor/phpunit/phpunit/src/Framework/TestSuite.php: call to PHPUnit\Framework\TestSuite->run()
* line 755 of /vendor/phpunit/phpunit/src/Framework/TestSuite.php: call to PHPUnit\Framework\TestSuite->run()
* line 755 of /vendor/phpunit/phpunit/src/Framework/TestSuite.php: call to PHPUnit\Framework\TestSuite->run()
* line 546 of /vendor/phpunit/phpunit/src/TextUI/TestRunner.php: call to PHPUnit\Framework\TestSuite->run()
* line 195 of /vendor/phpunit/phpunit/src/TextUI/Command.php: call to PHPUnit\TextUI\TestRunner->doRun()
* line 148 of /vendor/phpunit/phpunit/src/TextUI/Command.php: call to PHPUnit\TextUI\Command->run()
* line 53 of /vendor/phpunit/phpunit/phpunit: call to PHPUnit\TextUI\Command::main()

Failed asserting that 1 matches expected 0.

/lib/phpunit/classes/advanced_testcase.php:376
/privacy/tests/provider_test.php:163
/lib/phpunit/classes/advanced_testcase.php:91
polothy commented 6 years ago

Whoops, got that totally wrong. The problem is in the provider:

Index: blocks/xp/classes/privacy/provider.php
--- blocks/xp/classes/privacy/provider.php
+++ blocks/xp/classes/privacy/provider.php
@@ -69,7 +69,7 @@

         $collection->add_database_table('block_xp_log', [
             'userid' => 'privacy:metadata:log:userid',
-            'eventname' => 'privacy:metadata:log:lvl',
+            'eventname' => 'privacy:metadata:log:eventname',
             'xp' => 'privacy:metadata:log:xp',
             'time' => 'privacy:metadata:log:time',
         ], 'privacy:metadata:log');
polothy commented 6 years ago

Sigh, and you fixed this already. Was looking at lang file before making the issue.

FMCorz commented 6 years ago

Hah, no worries! For future reference, this was the commit: 4af4133b68b987e2fa6e30f3233bde0277c8c11f