1

when running vendor/bin/phpunit i received this error

$ vendor/bin/phpunit

PHPUnit 7.5.12 by Sebastian Bergmann and contributors.

.W 2 / 2 (100%)

Time: 113 ms, Memory: 12.00 MB

There was 1 warning:

1) Warning No tests found in class

and Then Tried reinstalling composer, and php unit to current version

$ vendor/bin/phpunit

PHPUnit 7.5.12 by Sebastian Bergmann and contributors.

.W 2 / 2 (100%)

Time: 113 ms, Memory: 12.00 MB

There was 1 warning:

1) Warning No tests found in class

Should show test successful

5
  • How is your file name and class named, please also inlcude sample class with one single test Commented Jun 14, 2019 at 12:23
  • forgot to put the /** @test */ before the tests! Thank you, answered my question Commented Jun 14, 2019 at 20:18
  • you can also name your test function with test like relation_test and it will work Commented Jun 14, 2019 at 20:56
  • 1
    @MartinHenriksen: but the test must be at the beginning of the test method name, not at then end, mustn't it? Commented Jul 1, 2019 at 20:26
  • @hakre yes i forgot, mixed it up with a place where we used /** (at)test **/ notation Commented Jul 3, 2019 at 11:02

1 Answer 1

1

Try This in your Testing Class:

/** @test **/
function your_test_func(){
   // assertion 
}

Compare with the Phpunit Documentation which give the following description of the @test annotation:

@test

As an alternative to prefixing your test method names with test, you can use the @test annotation in a method's DocBlock to mark it as a test method.

/**
 * @test
 */
public function initialBalanceShouldBe0()
{
    $this->assertEquals(0, $this->ba->getBalance());
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.