You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've just came across a problem with non test methods starting with test... - in my particular case it was a trait that generates either a single or multiple records for the Testimonial model. Here's the trait:
When used with the test class I get two warnings at the end:
Test method "testimonial"intest class "Tests\Feature\Admin\Testimonial\TestimonialTest" is not public.
Test method "testimonials"intest class "Tests\Feature\Admin\Testimonial\TestimonialTest" is not public.
When changed visibility of both of the methods to public, I get:
This test did not perform any assertions
/Users/sebastian/code/valet/chichester-park-hotel/tests/Traits/TestimonialTrait.php:19
ArgumentCountError : Too few arguments to functionTests\Feature\Admin\Testimonial\TestimonialTest::testimonials(), 0 passed in /Users/sebastian/code/valet/chichester-park-hotel/vendor/phpunit/phpunit/src/Framework/TestCase.php on line 1533 and at least 1 expected
/Users/sebastian/code/valet/chichester-park-hotel/tests/Traits/TestimonialTrait.php:32
I can obviously try to change method name, but I wonder if this has been reported before and can be fixed by detecting either camel / snake case method naming for the test prefix. If it's an overkill then not too worry, but I just thought I'll mention in case you could do a quick fix for it.
The text was updated successfully, but these errors were encountered:
The tests are public methods that are named test*
I think changing this to "name must begin with test followed by either an uppercase character or _" may be confusing and/or introduce unintended side effects.
You say it's clear, but it's not really because if you have a protected method starting with test* then you have the first warning I've shown in the original example so no, I don't think it's completely clear.
I've just came across a problem with non test methods starting with
test...
- in my particular case it was a trait that generates either a single or multiple records for theTestimonial
model. Here's the trait:When used with the test class I get two warnings at the end:
When changed visibility of both of the methods to public, I get:
I can obviously try to change method name, but I wonder if this has been reported before and can be fixed by detecting either camel / snake case method naming for the
test
prefix. If it's an overkill then not too worry, but I just thought I'll mention in case you could do a quick fix for it.The text was updated successfully, but these errors were encountered: