Undefined Method setGroups() in Codeception Unit Tests

I have a clean Yii2 advanced-template Application installed. Codecept run command gives me the following fatal error:

Any ideas what I am doing wrong?

Are you using a global version of composer instead of the one at ‘vendor/bin’ folder? It seems you have latest version of composer on your global scope. Do the following:

./vendor/bin/codecept run