-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Description
What are you trying to achieve?
Automate creating a test file using the generate:{suite/test} command, synched with IDE when a file is added/modified.
In this scenario, sometimes calculated relative path for the generating test file contains a dot. In that case, an invalid syntax is inserted in the resulting generated test file.
Passing a relative path is useful to keep a synchronized structure with the source directory. For example, passing "foo/bar" creates a test file unit/foo/barTest.php. This is great.
$ php codecept.phar generate:test unit "foo/bar"However, when it contains a dot, like
$ php codecept.phar generate:test unit "./foo"it creates a file fooTest.php with an invalid namespace syntax. The dot something passed by IDE.
What do you get instead?
A namespace with a dot gets inserted at the beginning of the generated file, which is invalid syntax and causes a fatal error. So it must be manually removed.
<?php namespace .;
class fooTest extends \Codeception\Test\Unit
{
/**
* @var \UnitTester
*/
protected $tester;
...Details
- Codeception version: 4.0.1 (I downloaded it from the 4.0.2 link but it says 4.0.1)
- PHP Version: 7.3
- Operating System: Windows 10
- Installation type: Phar
- Suite configuration:
actor: UnitTester
modules:
enabled:
- Asserts
- \Helper\Unit
step_decorators: ~
error_level: "E_ALL ^ E_NOTICE"
bootstrap: _bootstrap.php