Codeception: Uncaught Error: Class 'Yii' not found

Created on 10 Jan 2018  路  3Comments  路  Source: Codeception/Codeception

What are you trying to achieve?

What do you get instead?

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

# paste output here
Uncaught Error: Class 'Yii' not found in D:\phpStudy2\WWW\blog\vendor\codeceptio
n\codeception\src\Codeception\Lib\Connector\Yii2.php:75
Stack trace:
#0 D:\phpStudy2\WWW\blog\vendor\codeception\codeception\src\Codeception\Lib\Conn
ector\Yii2.php(53): Codeception\Lib\Connector\Yii2->startApp()
#1 D:\phpStudy2\WWW\blog\vendor\codeception\codeception\src\Codeception\Module\Y
ii2.php(185): Codeception\Lib\Connector\Yii2->getApplication()
#2 D:\phpStudy2\WWW\blog\vendor\codeception\codeception\src\Codeception\Subscrib
er\Module.php(56): Codeception\Module\Yii2->_before(Object(ExampleTest))
#3 D:\phpStudy2\WWW\blog\vendor\symfony\event-dispatcher\EventDispatcher.php(212
): Codeception\Subscriber\Module->before(Object(Codeception\Event\TestEvent), 't
est.before', Object(Symfony\Component\EventDispatcher\EventDispatcher))
#4 D:\phpStudy2\WWW\blog\vendor\symfony\event-dispatcher\EventDispatcher.php(44)
: Symfony\Component\EventDispatcher\EventDispatcher->doDispatch(Array, 'test.bef
ore', Object(Codeception\Event\TestEvent))
#
in D:\phpStudy2\WWW\blog\vendor\codeception\codeception\src\Codeception\Lib\Conn
ector\Yii2.php:75



Provide test source code if related

// paste test
widndows 
..\vendor\bin\codecept bootstrap
..\vendor\bin\codecept bootstrap
..\vendor\bin\codecept   generate:test unit Example
..\vendor\bin\codecept run 

..\vendor\bin\codecept generate:test unit Example 锛孴here is no mistake before the generation

Details

  • Codeception version:2.3
  • PHP Version:7.2.1
  • Operating System:windows
  • Installation type: Composer
  • List of installed packages (composer show)behat/gherkin v4.4.5 Gherkin DSL parser for PHP 5.3
    bower-asset/bootstrap v3.3.7
    bower-asset/inputmask 3.3.11
    bower-asset/jquery 3.2.1
    bower-asset/punycode v1.3.2
    bower-asset/typeahead.js v0.11.1
    bower-asset/yii2-pjax 2.0.7.1
    cebe/markdown 1.1.2 A super fast, highly extensi...
    codeception/codeception 2.3.7 BDD-style testing framework
    codeception/specify 0.4.6 BDD code blocks for PHPUnit ...
    codeception/verify 0.3.3 BDD assertion library for PH...
    doctrine/instantiator 1.1.0 A small, lightweight utility...
    ezyang/htmlpurifier v4.9.3 Standards compliant HTML fil...
    facebook/webdriver 1.5.0 A PHP client for Selenium We...
    fzaninotto/faker v1.7.1 Faker is a PHP library that ...
    guzzlehttp/guzzle 6.3.0 Guzzle is a PHP HTTP client ...
    guzzlehttp/promises v1.3.1 Guzzle promises library
    guzzlehttp/psr7 1.4.2 PSR-7 message implementation...
    myclabs/deep-copy 1.7.0 Create deep copies (clones) ...
    phar-io/manifest 1.0.1 Component for reading phar.i...
    phar-io/version 1.0.1 Library for handling version...
    phpdocumentor/reflection-common 1.0.1 Common reflection classes us...
    phpdocumentor/reflection-docblock 4.2.0 With this component, a libra...
    phpdocumentor/type-resolver 0.4.0
    phpspec/php-diff v1.1.0 A comprehensive library for ...
    phpspec/prophecy 1.7.3 Highly opinionated mocking f...
    phpunit/php-code-coverage 5.3.0 Library that provides collec...
    phpunit/php-file-iterator 1.4.5 FilterIterator implementatio...
    phpunit/php-text-template 1.2.1 Simple template engine.
    phpunit/php-timer 1.0.9 Utility class for timing
    phpunit/php-token-stream 2.0.2 Wrapper around PHP's tokeniz...
    phpunit/phpunit 6.4.4 The PHP Unit Testing framework.
    phpunit/phpunit-mock-objects 4.0.4 Mock Object library for PHPUnit
    psr/http-message 1.0.1 Common interface for HTTP me...
    sebastian/code-unit-reverse-lookup 1.0.1 Looks up which function or m...
    sebastian/comparator 2.1.1 Provides the functionality t...
    sebastian/diff 2.0.1 Diff implementation
    sebastian/environment 3.1.0 Provides functionality to ha...
    sebastian/exporter 3.1.0 Provides the functionality t...
    sebastian/global-state 2.0.0 Snapshotting of global state
    sebastian/object-enumerator 3.0.3 Traverses array structures a...
    sebastian/object-reflector 1.1.1 Allows reflection of object ...
    sebastian/recursion-context 3.0.0 Provides functionality to re...
    sebastian/resource-operations 1.0.0 Provides a list of PHP built...
    sebastian/version 2.0.1 Library that helps with mana...
    swiftmailer/swiftmailer v5.4.8 Swiftmailer, free feature-ri...
    symfony/browser-kit v4.0.3 Symfony BrowserKit Component
    symfony/console v4.0.3 Symfony Console Component
    symfony/css-selector v4.0.3 Symfony CssSelector Component
    symfony/dom-crawler v4.0.3 Symfony DomCrawler Component
    symfony/event-dispatcher v4.0.3 Symfony EventDispatcher Comp...
    symfony/finder v4.0.3 Symfony Finder Component
    symfony/polyfill-mbstring v1.6.0 Symfony polyfill for the Mbs...
    symfony/process v4.0.3 Symfony Process Component
    symfony/yaml v4.0.3 Symfony Yaml Component
    theseer/tokenizer 1.1.0 A small library for converti...
    webmozart/assert 1.2.0 Assertions to validate metho...
    yiisoft/yii2 2.0.13.1 Yii PHP Framework Version 2
    yiisoft/yii2-bootstrap 2.0.7 The Twitter Bootstrap extens...
    yiisoft/yii2-composer 2.0.5 The composer plugin for Yii ...
    yiisoft/yii2-debug 2.0.13 The debugger extension for t...
    yiisoft/yii2-faker 2.0.3 Fixture generator. The Faker...
    yiisoft/yii2-gii 2.0.6 The Gii extension for the Yi...
    yiisoft/yii2-swiftmailer 2.0.7 The SwiftMailer integration ...

  • Suite configuration:

# paste suite config here
unit.suite.yml
actor: UnitTester
modules:
  enabled:
     - Asserts
     - Yii2:
         configFile: '/../config/test.php'
         part: init

functional.suite.yml
actor: FunctionalTester
modules:
  enabled:
     - Yii2:
         configFile: '/../config/test.php'

acceptance.suite.yml
actor: AcceptanceTester
modules:
    enabled:
        - WebDriver:
            url: http://blog.com/
            browser: firefox
        - Yii2:
            configFile: '/../config/test.php'
            part: ORM # allow to use AR methods
            transaction: false # don't wrap test in transaction
            cleanup: false # don't cleanup the fixtures
            entryScript: index-test.php
Yii

Most helpful comment

I think this issue can be closed.

Can you explain this?
This issue isn't really fixed or someting and it's a issue hot on this this topic in duckduckgo, so maybe you can explain what was wrong and why this isn't fixed (or what was wrong with the issue)?

All 3 comments

The above configuration is used in this yii2 document, which does not have this error if it is not configured to modify the configuration

I think this issue can be closed.

I think this issue can be closed.

Can you explain this?
This issue isn't really fixed or someting and it's a issue hot on this this topic in duckduckgo, so maybe you can explain what was wrong and why this isn't fixed (or what was wrong with the issue)?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Breadleyg picture Breadleyg  路  3Comments

marcelodeandrade picture marcelodeandrade  路  3Comments

gimler picture gimler  路  3Comments

DavertMik picture DavertMik  路  4Comments

nikolaykolev picture nikolaykolev  路  3Comments