Codeception icon indicating copy to clipboard operation
Codeception copied to clipboard

generate:test generate invalid code when test suite has no actor

Open Naktibalda opened this issue 3 years ago • 0 comments

What are you trying to achieve?

Generate valid unit test

What do you get instead?

<?php


namespace Tests\Unit;

use Tests\Support\;

class FirstTest extends \Codeception\Test\Unit
{

    protected function _before()
    {
    }

    // tests
    public function testSomeFeature()
    {

    }
}

Provide console output if related. Use -vvv mode for more details.

$ ./vendor/bin/codecept init unit
 This will install Codeception for unit testing only

? Where tests will be stored? (tests)

Codeception provides additional features for integration tests
Like accessing frameworks, ORM, Database.
? Do you wish to enable them? (y/n) n
 Adding codeception/module-asserts for Asserts to composer.json
1 new packages added to require
? composer.json updated. Do you want to run "composer update"? (y/n) y
 Running composer update
Loading composer repositories with package information
Updating dependencies
Lock file operations: 1 install, 0 updates, 0 removals
  - Locking codeception/module-asserts (dev-master 1b6b150)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 1 install, 0 updates, 0 removals
  - Installing codeception/module-asserts (dev-master 1b6b150): Extracting archive
Generating autoload files
39 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
 Created test directory inside at tests

 INSTALLATION COMPLETE

Unit tests will be executed in random order
Use @depends annotation to change the order of tests

Next steps:
Create the first test using codecept g:test unit MyTest
Run tests with codecept run
Happy testing!

$ ./vendor/bin/codecept ge:test unit First
Test was created in /.../tests/./FirstTest.php
$  ./vendor/bin/codecept run
Codeception PHP Testing Framework v5.0.5 https://helpukrainewin.org
[Seed] 1521305280

In Parser.php line 103:

  Couldn't parse test '/.../tests/./FirstTest.php' on line 6
  syntax error, unexpected token ";", expecting "{"

Naktibalda avatar Nov 20 '22 18:11 Naktibalda