Skip to content

Instantly share code, notes, and snippets.

@nurcahyo
Last active December 16, 2015 22:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nurcahyo/0622da0e5827cf7bc8e7 to your computer and use it in GitHub Desktop.
Save nurcahyo/0622da0e5827cf7bc8e7 to your computer and use it in GitHub Desktop.
Yii1 Codeception Configuration
coverage:
enabled: true
include:
- protected/components/*.php
- protected/controllers/*.php
- protected/models/*.php
exclude:
- vendor/*
- protected/runtime/*
- protected/yiic
- protected/yiic.bat
- protected/yiic.php
paths:
tests: tests
log: tests/_log
data: tests/_data
helpers: tests/_helpers
settings:
bootstrap: _bootstrap.php
suite_class: \PHPUnit_Framework_TestSuite
colors: true
memory_limit: 1024M
convertNoticesToExceptions: true
convertWarningsToExceptions: true
stopOnError: false
stopOnFailure: false
stopOnIncomplete: false
stopOnSkipped: false
log: true
modules:
config:
Yii1:
appPath: '/var/www/kmore/tests/index.php'
url: 'http://localhost/kmore/tests/index.php'
Db:
dsn: 'mysql:host=localhost;dbname=dev'
user: 'develop'
password: 'develop'
dump: tests/_data/dump.sql
<?php
defined("ENVIRONMENT") or define("ENVIRONMENT", "public");
Yii::setPathOfAlias('vendor', dirname(__FILE__) . DIRECTORY_SEPARATOR . '../../vendor');
Yii::import('vendor.helper.*');
// uncomment the following to define a path alias
// Yii::setPathOfAlias('local','path/to/local-folder');
// This is the main Web application configuration. Any writable
// CWebApplication properties can be configured here.
return array(
'basePath' => dirname(__FILE__) . DIRECTORY_SEPARATOR . '..',
'name' => 'Knowledge Management Online Report',
// preloading 'log' component
'preload' => array('log'),
// autoloading model and component classes
'import' => array(
'application.interfaces.*',
'application.models.*',
'application.components.*',
),
'modules' => CYaml::parse(dirname(__FILE__) . '/module.yml'),
// application components
'components' => array(
'ldap' => array(
'class' => 'CLDAPConnector',
'host' => "ldap://merahputih.telkom.co.id",
"dn" => "o=Telkom",
),
'user' => array(
'class' => 'WebUser',
// enable cookie-based authentication
'allowAutoLogin' => true,
),
// uncomment the following to enable URLs in path-format
'urlManager' => ENVIRONMENT == "test" ? array() : array(
'urlFormat' => 'path',
'showScriptName' => false,
'rules' => CYaml::parse(dirname(__FILE__) . '/route.yml'),
),
// uncomment the following to use a MySQL database
'db' => CYaml::parse(dirname(__FILE__) . '/db.yml'),
'errorHandler' => array(
// use 'site/error' action to display errors
'errorAction' => 'site/error',
),
'log' => array(
'class' => 'CLogRouter',
'routes' => array(
array(
'class' => 'CFileLogRoute',
'levels' => 'error, warning',
),
// uncomment the following to show log messages on web pages
/*
array(
'class'=>'CWebLogRoute',
),
*/
),
),
),
// application-level parameters that can be accessed
'params' => CYaml::parse(dirname(__FILE__) . '/params.yml')
);
## List urle rules here
---
/: site/index
0:
0: 'ajax/<action>'
pattern: 'ajax/<action>'
urlSuffix: .html
caseSensitive: false
"<controller:\w+>/<id:\d+>": '<controller>/view'
"<controller:\w+>/<action:\w+>/<id:\d+>": '<controller>/<action>'
"<controller:\w+>/<action:\w+>": '<controller>/<action>'
return CMap::mergeArray(
require(dirname(__FILE__) . '/main.php'), array(
'components' => array(
'request' => array(
'class' => 'CodeceptionHttpRequest',
),
'fixture' => array(
'class' => 'system.test.CDbFixtureManager',
),
'db' => CYaml::parse(dirname(__FILE__) . '/db-test.yml')
),
)
);
class_name: TestGuy
coverage:
enabled: true
modules:
enabled: [Yii1,TestHelper]
<?php
$I = new TestGuy($scenario);
$I->wantTo("Test login");
$I->amOnPage("site/login");
$I->see("login");
?>
class_name: CodeGuy
modules:
enabled: [Unit, CodeHelper]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment