I made a PHPUnit test for my moodle plugin But always get this error. It suppose that for every transaction a message sent to the user In live website, this function works fine but not in the PHPUnit test?
How to enable this message provider in the test code?
Debugging: Attempt to send msg from a provider enrol_wallet/wallet_transaction that is inactive or not allowed for the user id=148000
- line 225 of /lib/messagelib.php: call to debugging()
- line 80 of /enrol/wallet/classes/notifications.php: call to message_send()
- line 144 of /enrol/wallet/classes/transactions.php: call to enrol_wallet\notifications::transaction_notify()
- line 64 of /enrol/wallet/tests/transactions_test.php: call to enrol_wallet\transactions::debit()
- line 1548 of /vendor/phpunit/phpunit/src/Framework/TestCase.php: call to enrol_wallet\transactions_test->test_credit_debit()
- line 1154 of /vendor/phpunit/phpunit/src/Framework/TestCase.php: call to PHPUnit\Framework\TestCase->runTest()
- line 80 of /lib/phpunit/classes/advanced_testcase.php: call to PHPUnit\Framework\TestCase->runBare()
- line 728 of /vendor/phpunit/phpunit/src/Framework/TestResult.php: call to advanced_testcase->runBare()
- line 904 of /vendor/phpunit/phpunit/src/Framework/TestCase.php: call to PHPUnit\Framework\TestResult->run()
- line 675 of /vendor/phpunit/phpunit/src/Framework/TestSuite.php: call to PHPUnit\Framework\TestCase->run()
- line 675 of /vendor/phpunit/phpunit/src/Framework/TestSuite.php: call to PHPUnit\Framework\TestSuite->run()
- line 675 of /vendor/phpunit/phpunit/src/Framework/TestSuite.php: call to PHPUnit\Framework\TestSuite->run()
- line 661 of /vendor/phpunit/phpunit/src/TextUI/TestRunner.php: call to PHPUnit\Framework\TestSuite->run()
- line 144 of /vendor/phpunit/phpunit/src/TextUI/Command.php: call to PHPUnit\TextUI\TestRunner->run()
- line 97 of /vendor/phpunit/phpunit/src/TextUI/Command.php: call to PHPUnit\TextUI\Command->run()
- line 98 of /vendor/phpunit/phpunit/phpunit: call to PHPUnit\TextUI\Command::main()
- line 122 of /vendor/bin/phpunit: call to include()
When I used:
message_get_providers_from_db('enrol_wallet');
or
message_get_providers_from_file('enrol_wallet');
both indicated that the provider existed and active
but when I use:
message_get_providers_for_user($user->id);
The provider not exist in the array.