Cache mock exception after update Laravel 6.0 - laravel-6

I have unit tests with Cache mocks. It worked well before update laravel to 6.0
After update I ran my tests and got an exception
Mockery\Exception\BadMethodCallException: Received
Mockery_2_Illuminate_Cache_CacheManager::driver(), but no expectations
were specified
Cache::shouldReceive('get')
->once()
->with('table_3_'.config('constants.league.premier').'_'.config('constants.sex.female'))
->andReturn(json_encode([
[
'id' => $team1->id,
'place' => 1
],
[
'id' => $team2->id,
'place' => 8
],
[
'id' => $team3->id,
'place' => 11
],
]));
$this->artisan('passport:transfer');

I have found the answer here - Laravel Feature Testing. Cache mocking not working! CacheManager::driver(), but no expectations were specified
but I don't understand why before update the test was ok

Related

Logstash|exception=>"LogStash::ConfigurationError",:message=>"Expected one of [ \\t\\r\\n], \"#\", \"=>\" at line 22, column 20

Recently I encountered a little white problem when I was learning logstash,I try to transfer data from Kafka to Bigquery
I'm instantiating logstash using -
logstash-8.2.3/bin/logstash -f config/logstash-sample.conf
Config File
input {
kafka {
bootstrap_servers => ["addcn102:9092,addcn103:9092,addcn104:9092"]
group_id => "logstash_kagka"
auto_offset_reset => "earliest"
consumer_threads => 3
topics => ["houstonbq"]
codec => "json"
}
}
output {
google_bigquery {
project_id => "newcar8891"
dataset => "logstash"
json_key_file => "/home/shurui/bin/newcar8891-013ef3777de7.json"
error_directory => "/opt/module/bqerror"
flush_interval_secs => "30"
csv_schema >= "message:STRING"
}
}
This is error log
Using bundled JDK: /opt/module/logstash-8.2.3/jdk
OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
Sending Logstash logs to /opt/module/logstash-8.2.3/logs which is now configured via log4j2.properties
[2022-10-21T17:19:07,041][INFO ][logstash.runner ] Log4j configuration path used is: /opt/module/logstash-8.2.3/config/log4j2.properties
[2022-10-21T17:19:07,051][WARN ][logstash.runner ] The use of JAVA_HOME has been deprecated. Logstash 8.0 and later ignores JAVA_HOME and uses the bundled JDK. Running Logstash with the bundled JDK is recommended. The bundled JDK has been verified to work with each specific version of Logstash, and generally provides best performance and reliability. If you have compelling reasons for using your own JDK (organizational-specific compliance requirements, for example), you can configure LS_JAVA_HOME to use that version instead.
[2022-10-21T17:19:07,052][INFO ][logstash.runner ] Starting Logstash {"logstash.version"=>"8.2.3", "jruby.version"=>"jruby 9.2.20.1 (2.5.8) 2021-11-30 2a2962fbd1 OpenJDK 64-Bit Server VM 11.0.15+10 on 11.0.15+10 +indy +jit [linux-x86_64]"}
[2022-10-21T17:19:07,054][INFO ][logstash.runner ] JVM bootstrap flags: [-Xms1g, -Xmx1g, -XX:+UseConcMarkSweepGC, -XX:CMSInitiatingOccupancyFraction=75, -XX:+UseCMSInitiatingOccupancyOnly, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djruby.compile.invokedynamic=true, -Djruby.jit.threshold=0, -XX:+HeapDumpOnOutOfMemoryError, -Djava.security.egd=file:/dev/urandom, -Dlog4j2.isThreadContextMapInheritable=true, -Djruby.regexp.interruptible=true, -Djdk.io.File.enableADS=true, --add-opens=java.base/java.security=ALL-UNNAMED, --add-opens=java.base/java.io=ALL-UNNAMED, --add-opens=java.base/java.nio.channels=ALL-UNNAMED, --add-opens=java.base/sun.nio.ch=ALL-UNNAMED, --add-opens=java.management/sun.management=ALL-UNNAMED]
[2022-10-21T17:19:07,349][WARN ][logstash.config.source.multilocal] Ignoring the 'pipelines.yml' file because modules or command line options are specified
[2022-10-21T17:19:08,125][INFO ][logstash.agent ] Successfully started Logstash API endpoint {:port=>9600, :ssl_enabled=>false}
[2022-10-21T17:19:08,401][ERROR][logstash.agent ] Failed to execute action {:action=>LogStash::PipelineAction::Create/pipeline_id:main,
:exception=>"LogStash::ConfigurationError",
:message=>"Expected one of [ \\t\\r\\n], \"#\", \"=>\" at line 19, column 13 (byte 420)
after output
{\n google_bigquery {\n\t
project_id => \"newcar8891\"\n\t
dataset => \"logstash\"\n\t
csv_schema ",:backtrace=>["/opt/module/logstash-8.2.3/logstash-core/lib/logstash/compiler.rb:32:in `compile_imperative'",
"org/logstash/execution/AbstractPipelineExt.java:189:in `initialize'",
"org/logstash/execution/JavaBasePipelineExt.java:72:in `initialize'",
"/opt/module/logstash-8.2.3/logstash-core/lib/logstash/java_pipeline.rb:48:in `initialize'",
"/opt/module/logstash-8.2.3/logstash-core/lib/logstash/pipeline_action/create.rb:50:in `execute'",
"/opt/module/logstash-8.2.3/logstash-core/lib/logstash/agent.rb:381:in `block in converge_state'"]}
[2022-10-21T17:19:08,471][INFO ][logstash.runner ] Logstash shut down.
This is my kafka data
{
"#timestamp" => 2022-10-21T09:24:51.281353Z,
"message" => "help me \b",
"tags" => [
[0] "_jsonparsefailure"
],
"#version" => "1"
}
I want to send the content of the message to bigquery
From error message it can be understood that there is a syntax error in your output plugin configuration. Try below output plugin in config.
output {
google_bigquery {
project_id => "newcar8891"
dataset => "logstash"
csv_schema => "message:STRING"
json_key_file => "/home/shurui/bin/newcar8891-013ef3777de7.json"
error_directory => "/opt/module/bqerror"
flush_interval_secs => "30"
}
}

How to add aliases in yii2?

I have extracted mdmsoft extension in my backend/extensions/mdm folder. Added aliases in backend config main.php
'aliases' => [
'#mdm/admin' => '#backend/extensions/mdm'
]
Added module as
[
'modules' => [
'admin' => [
'class' => 'mdm\admin\Module'
]
]
],
It returns me error.Failed to instantiate component or class "mdm\admin\Module".
How I can manage the config file that MDM works from my backend folder
Maybe you have to add line below:
Yii::setAlias('#mdm', dirname(dirname(__DIR__)) . '/backend/extensions/mdm');
into common/config/bootstrap.php ?

controllermap in yii2 return 404

I walk around yii2 manual by copy this code in manual
'controllerMap' => [
'account' => 'yii\app\controllers\UserController',
'article' => [
'class' => 'yii\app\controllers\PostController',
'enableCsrfValidation' => false,
],
],
paste in netbean
just access it
already have UserController
Your namespace is wrong! If you look at documentation, the correct code is like this:
[
'controllerMap' => [
'account' => 'app\controllers\UserController',
'article' => [
'class' => 'app\controllers\PostController',
'enableCsrfValidation' => false,
],
],
]
But you have an extra yii in the beginning of the namespace, so yii\app\controllers\UserController must be app\controllers\UserController.
Also i think you have some problems in url rewriting. If I'm true, you can find an instrument for fixing it in http://www.yiiframework.com/doc-2.0/guide-runtime-routing.html#using-pretty-urls and yii2 url rewrite config.

Laravel 5.0 Sweet Alert Class 'UxWeb\SweetAlert\SweetAlertServiceProvider' not found

please i have done these :
"require": {
"uxweb/sweet-alert": "~1.1",
}
'providers' => [
'UxWeb\SweetAlert\SweetAlertServiceProvider::class'
]
'aliases' => [
'Alert' => UxWeb\SweetAlert\SweetAlert::class
]
but i keep getting the error.
I was working under proxy therefore my internet connection was not working in the command line hence,
composer update
Was not working

Yii2 disable asset of a vendor module

I have installed yii2-admin module, located in /vendor/mdmsoft/yii2-admin but I don't want it to load its own asset bundle. It there any way to disable this module asset bundle?
Yes, it's possible and even mentioned in official docs here. One way to do it is through application config:
return [
// ...
'components' => [
'assetManager' => [
'bundles' => [
'mdm\admin\AdminAsset' => false,
],
],
],
];
Another way - during runtime through component:
\Yii::$app->assetManager->bundles['mdm\admin\AdminAsset'] = false;