Comments (6)
It seems you aren't returning true
from the closure.
from log-fake.
Hey, all the examples in the readme return a boolean, either true
or false
, e.g.,
Log::channel('slack')->assertLogged(
fn (LogEntry $log) => $log->message === 'User logged in.'
);
from log-fake.
I understand, but in my first acquaintance with the package it was perceived as a simple assertion
from log-fake.
Can you please share the actual test snippet you are using in your tests?
from log-fake.
Yes, I can. In general, the test is simple - it shows that the rendering is correct (the rendering is processed at the Handler level in the Exceptions directory). Here is the code:
PS. If it helps, here's a list of the packages I'm using
"require": {
"php": "^8.2",
"bschmitt/laravel-amqp": "^2.1",
"darkaonline/l5-swagger": "^8.5",
"guzzlehttp/guzzle": "^7.2",
"intervention/image": "^2.7",
"laravel/framework": "^10.16",
"laravel/sanctum": "^3.2",
"laravel/tinker": "^2.8",
"maatwebsite/excel": "^3.1",
"mews/purifier": "^3.4",
"spatie/laravel-permission": "^5.10",
"stancl/tenancy": "^3.7",
"tymon/jwt-auth": "^2.0",
"vladimir-yuldashev/laravel-queue-rabbitmq": "^13.3",
"webmozart/assert": "^1.11"
},
"require-dev": {
"dg/bypass-finals": "^1.4",
"fakerphp/faker": "^1.9.1",
"laravel/pint": "^1.0",
"laravel/sail": "^1.18",
"mockery/mockery": "^1.4.4",
"nunomaduro/collision": "^7.0",
"phpunit/phpunit": "^10.1",
"psalm/plugin-laravel": "^2.8",
"roave/security-advisories": "dev-latest",
"spatie/laravel-ignition": "^2.0",
"squizlabs/php_codesniffer": "^3.7",
"timacdonald/log-fake": "^2.1"
},
from log-fake.
Yes, you are right! :-) Thank's! (just add return true
:-) )
But, in the readme there is no direct instruction to return true
or I didn't see it.... And if there is nothing about true, maybe it should be added?
Something like this:
Log::channel(channel: 'channel_name')->assertLogged(callback: function (LogEntry $log) {
// ... your assertions
return true;
}
);
and put "or not true
returned" in the exception message.
from log-fake.
Related Issues (14)
- Error in docs HOT 2
- Check 2 messages in the same channel HOT 5
- Call to undefined method TiMacDonald\Log\LogFake::getHandlers() HOT 3
- useless when called multiple times HOT 2
- Log assertion not hit after expecting an exception in PHPUnit HOT 1
- Laravel 9 support HOT 8
- Support for Log::withContext($context) HOT 2
- LogFake::bind() is not working with Laravel 8.x HOT 2
- listen method support ? HOT 2
- Laravel 10 Support HOT 3
- PHPUnit 10 HOT 1
- [Request] Support for Log::shareContext HOT 1
- Error: Call to undefined method TiMacDonald\Log\ChannelFake::flushSharedContext()
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from log-fake.