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

Please allow some way to communicate with code in TestListener from CLI #4324

Closed
hparadiz opened this issue Jun 25, 2020 · 1 comment
Closed
Labels
type/enhancement A new idea that should be implemented

Comments

@hparadiz
Copy link

hparadiz commented Jun 25, 2020

I noticed some old feature requests where people wanted custom CLI switches. It's fair that you don't want to allow people to define their own I suppose but consider this.

I regularly will want to skip the Mock phase of the test. Especially when I'm rapidly iterating on one specific test that might not even edit anything or need anything in the database.

Typically this Mocking happens in TestListener like so

	public function startTestSuite(TestSuite $suite): void
	{
		//printf("TestSuite '%s' started.\n", $suite->getName());
		if ($suite->getName() == 'all') {
			$app = new App(realpath(__DIR__.'/../../webapp/'));
			fwrite(STDERR, 'Starting Mock Environment for PHPUnit'."\n");
			Mock::setUp();
		}
	}

However in recent months I've taken to using a file on the file system to tell it to skip the mock phase like so:

	if (file_exists('tests/.NoMock')) {
		fwrite(STDERR, 'Skipping setup.'."\n");
		return;
	}

So my request is to add some CLI switch that could signify that you would like to skip the mock phase or somehow modify it.

However, if there are better way to do this I am all ears.

@hparadiz hparadiz added the type/enhancement A new idea that should be implemented label Jun 25, 2020
@sebastianbergmann
Copy link
Owner

The TestListener system is scheduled for removal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/enhancement A new idea that should be implemented
Projects
None yet
Development

No branches or pull requests

2 participants