Skip to content
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

Under certain condition, @testCase annotation is ignored by Nette Tester #455

Open
Marian-Kechlibar opened this issue Jan 17, 2025 · 0 comments

Comments

@Marian-Kechlibar
Copy link

Version: 2.5.4

Bug Description

I use PhpStorm Code Inspection extensively and sometimes I suppress certain inspections for the entire file. Suppression of inspections is done using a similar comment at the beginning of the file.

/**
@noinspection PhpUnhandledExceptionInspection Because ->run() can throw an AssertException and it is, in fact, desirable to happen if the test fails.
*/

PhpStorm generates such comments for you when you indicate your intent to suppress certain inspections, BUT once it places them into TestCase files, Nette Tester will become confused and stop treating them as TestCase files.

It is likely that Nette Tester expects the @testcase annotation to be in the first comment of the file.

Steps To Reproduce

Make your own test that starts like this:

<?php

/** @noinspection PhpUnhandledExceptionInspection Because ->run() can throw an AssertException and it is, in fact, desirable to happen if the test fails. */

declare(strict_types=1);

namespace (your namespace)

use (your use statements)


/**
 * @testCase
 */
final class SystemTest extends TestCase
{
	protected function test1() {...}

	protected function test2() {...}

}

You will see that the test methods no longer run in separate processes.

Expected Behavior

I would expect Nette Tester to accept the possibility of having @testcase annotation in any comment before the "class extends ..." line, not necessarily the first one.

All sorts of automated tools add comments into files, thus possibly breaking the "first comment in the file" principle.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant