Conversation
src/Framework/Value.php
Outdated
| } | ||
|
|
||
|
|
||
| public function assert(callable $cb): self |
There was a problem hiding this comment.
must require Closure to avoid collision with __call
|
Maybe call it |
|
I think that it's quite problematic that both |
|
Or what about Is::notSame($expected)
Is::equal($expected)
Is::notEqual($expected)
Is::contains($needle) // hmmm
Is::notContains($needle)
Is::nan()
Is::truthy()
Is::falsey()
Is::count(int $count)
Is::type($type)
Is::match(string $pattern) // hmmm.. add alias Is::pattern(), Assert::pattern() ?
Is::matchFile(string $file)These ones will probably will never used: Is::same($expected)
Is::true()
Is::false()
Is::null() |
In fact, bigger problem is that |
|
So better will be this syntax |
e8f6a0e to
dafa51d
Compare
|
👍 What about |
|
And what about implement all supported static |
|
'Expect' sound good.
This is of course possible, but where do you see the stack trace? |
Nothing. As I would never said that :) |
a9f7ce3 to
5bd73bc
Compare
This PR attempts to simplify the comparsion of structures that contain some variable data like this:
I'd like make assertions that
$actualis arraya,b,cAssert::type('string')+Assert::match('%h%', $value)Assert::type('DateTime', $value)Assert::type('int', $value)) and >= 0 (Assert::true($value >= 0)This PR allows to describe it using Assert::equal() + language similar to how
Assertis used. OnlyAssert::is replaced withExpect::In case of error it writes:
Class name
Expectand methods are just working names. IsAssert::equal()good choice?