-
-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added Expect #398
Added Expect #398
Conversation
src/Framework/Value.php
Outdated
} | ||
|
||
|
||
public function assert(callable $cb): self |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
$actual
is arraya
,b
,c
Assert::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
Assert
is used. OnlyAssert::
is replaced withExpect::
In case of error it writes:
Class name
Expect
and methods are just working names. IsAssert::equal()
good choice?