Search

Codeception\Util\Autoload

Autoloader, which is fully compatible with PSR-4, and can be used to autoload your Helper, Page, and Step classes.

addNamespace()

public static addNamespace($prefix, $baseDir, $prepend = false)

  • param string $prefix The namespace prefix.
  • param string $baseDir A base directory for class files in the namespace.
  • param bool $prepend If true, prepend the base directory to the stack instead of appending it; this causes it to be searched first rather than last.
  • return void

Adds a base directory for a namespace prefix.

Example:

<?php
// app\Codeception\UserHelper will be loaded from '/path/to/helpers/UserHelper.php'
Autoload::addNamespace('app\Codeception', '/path/to/helpers');

// LoginPage will be loaded from '/path/to/pageobjects/LoginPage.php'
Autoload::addNamespace('', '/path/to/pageobjects');

Autoload::addNamespace('app\Codeception', '/path/to/controllers');

See source

load()

public static load($class)

  • param string $class
  • return string|false

See source

 

Reference is taken from the source code. Help us to improve documentation. Edit module reference
Don't know how to write tests on your own? We will build or improve them for you. Request a quote for official enterprise support or trainings