Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
cef430af
Commit
cef430af
authored
Aug 16, 2014
by
Alexander Makarov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Renamed guy classes to actors, fixed phpdoc and code style
parent
1bf6843d
Show whitespace changes
Inline
Side-by-side
Showing
55 changed files
with
137 additions
and
80 deletions
+137
-80
.gitignore
apps/advanced/tests/codeception/backend/.gitignore
+3
-3
acceptance.suite.yml
apps/advanced/tests/codeception/backend/acceptance.suite.yml
+1
-1
LoginCept.php
...vanced/tests/codeception/backend/acceptance/LoginCept.php
+2
-2
functional.suite.yml
apps/advanced/tests/codeception/backend/functional.suite.yml
+1
-1
LoginCept.php
...vanced/tests/codeception/backend/functional/LoginCept.php
+2
-2
unit.suite.yml
apps/advanced/tests/codeception/backend/unit.suite.yml
+1
-1
.gitignore
apps/advanced/tests/codeception/common/.gitignore
+3
-3
LoginPage.php
apps/advanced/tests/codeception/common/_pages/LoginPage.php
+7
-3
FixtureHelper.php
...anced/tests/codeception/common/_support/FixtureHelper.php
+1
-1
UserFixture.php
...dvanced/tests/codeception/common/fixtures/UserFixture.php
+3
-0
unit.suite.yml
apps/advanced/tests/codeception/common/unit.suite.yml
+1
-1
DbTestCase.php
apps/advanced/tests/codeception/common/unit/DbTestCase.php
+3
-0
TestCase.php
apps/advanced/tests/codeception/common/unit/TestCase.php
+3
-0
LoginFormTest.php
...ed/tests/codeception/common/unit/models/LoginFormTest.php
+6
-0
.gitignore
apps/advanced/tests/codeception/console/.gitignore
+1
-1
unit.suite.yml
apps/advanced/tests/codeception/console/unit.suite.yml
+1
-1
DbTestCase.php
apps/advanced/tests/codeception/console/unit/DbTestCase.php
+3
-0
TestCase.php
apps/advanced/tests/codeception/console/unit/TestCase.php
+3
-0
.gitignore
apps/advanced/tests/codeception/frontend/.gitignore
+3
-3
AboutPage.php
.../advanced/tests/codeception/frontend/_pages/AboutPage.php
+4
-0
ContactPage.php
...dvanced/tests/codeception/frontend/_pages/ContactPage.php
+6
-2
SignupPage.php
...advanced/tests/codeception/frontend/_pages/SignupPage.php
+6
-2
acceptance.suite.yml
.../advanced/tests/codeception/frontend/acceptance.suite.yml
+1
-1
AboutCept.php
...anced/tests/codeception/frontend/acceptance/AboutCept.php
+2
-2
ContactCept.php
...ced/tests/codeception/frontend/acceptance/ContactCept.php
+2
-2
HomeCept.php
...vanced/tests/codeception/frontend/acceptance/HomeCept.php
+2
-2
LoginCept.php
...anced/tests/codeception/frontend/acceptance/LoginCept.php
+2
-2
SignupCest.php
...nced/tests/codeception/frontend/acceptance/SignupCest.php
+4
-4
functional.suite.yml
.../advanced/tests/codeception/frontend/functional.suite.yml
+1
-1
AboutCept.php
...anced/tests/codeception/frontend/functional/AboutCept.php
+2
-2
ContactCept.php
...ced/tests/codeception/frontend/functional/ContactCept.php
+2
-2
HomeCept.php
...vanced/tests/codeception/frontend/functional/HomeCept.php
+2
-2
LoginCept.php
...anced/tests/codeception/frontend/functional/LoginCept.php
+2
-2
SignupCest.php
...nced/tests/codeception/frontend/functional/SignupCest.php
+4
-4
unit.suite.yml
apps/advanced/tests/codeception/frontend/unit.suite.yml
+1
-1
DbTestCase.php
apps/advanced/tests/codeception/frontend/unit/DbTestCase.php
+3
-0
TestCase.php
apps/advanced/tests/codeception/frontend/unit/TestCase.php
+3
-0
.gitignore
apps/basic/tests/codeception/.gitignore
+3
-3
AboutPage.php
apps/basic/tests/codeception/_pages/AboutPage.php
+4
-0
ContactPage.php
apps/basic/tests/codeception/_pages/ContactPage.php
+6
-2
LoginPage.php
apps/basic/tests/codeception/_pages/LoginPage.php
+7
-3
acceptance.suite.yml
apps/basic/tests/codeception/acceptance.suite.yml
+1
-1
AboutCept.php
apps/basic/tests/codeception/acceptance/AboutCept.php
+1
-1
ContactCept.php
apps/basic/tests/codeception/acceptance/ContactCept.php
+1
-1
HomeCept.php
apps/basic/tests/codeception/acceptance/HomeCept.php
+1
-1
LoginCept.php
apps/basic/tests/codeception/acceptance/LoginCept.php
+1
-1
functional.suite.yml
apps/basic/tests/codeception/functional.suite.yml
+1
-1
AboutCept.php
apps/basic/tests/codeception/functional/AboutCept.php
+1
-1
ContactCept.php
apps/basic/tests/codeception/functional/ContactCept.php
+1
-1
HomeCept.php
apps/basic/tests/codeception/functional/HomeCept.php
+1
-1
LoginCept.php
apps/basic/tests/codeception/functional/LoginCept.php
+1
-1
unit.suite.yml
apps/basic/tests/codeception/unit.suite.yml
+1
-1
BasePage.php
extensions/codeception/BasePage.php
+5
-5
DbTestCase.php
extensions/codeception/DbTestCase.php
+2
-0
README.md
extensions/codeception/README.md
+2
-2
No files found.
apps/advanced/tests/codeception/backend/.gitignore
View file @
cef430af
# these files are auto generated by codeception build
# these files are auto generated by codeception build
/unit/
CodeGuy
.php
/unit/
UnitTester
.php
/functional/
TestGuy
.php
/functional/
FunctionalTester
.php
/acceptance/
WebGuy
.php
/acceptance/
AcceptanceTester
.php
apps/advanced/tests/codeception/backend/acceptance.suite.yml
View file @
cef430af
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
# RUN `build` COMMAND AFTER ADDING/REMOVING MODULES.
# RUN `build` COMMAND AFTER ADDING/REMOVING MODULES.
class_name
:
WebGuy
class_name
:
AcceptanceTester
modules
:
modules
:
enabled
:
enabled
:
-
PhpBrowser
-
PhpBrowser
...
...
apps/advanced/tests/codeception/backend/acceptance/LoginCept.php
View file @
cef430af
<?php
<?php
use
codeception_backend\
WebGuy
;
use
codeception_backend\
AcceptanceTester
;
use
codeception\common\_pages\LoginPage
;
use
codeception\common\_pages\LoginPage
;
$I
=
new
WebGuy
(
$scenario
);
$I
=
new
AcceptanceTester
(
$scenario
);
$I
->
wantTo
(
'ensure login page works'
);
$I
->
wantTo
(
'ensure login page works'
);
$loginPage
=
LoginPage
::
openBy
(
$I
);
$loginPage
=
LoginPage
::
openBy
(
$I
);
...
...
apps/advanced/tests/codeception/backend/functional.suite.yml
View file @
cef430af
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
# RUN `build` COMMAND AFTER ADDING/REMOVING MODULES.
# RUN `build` COMMAND AFTER ADDING/REMOVING MODULES.
#basic/web/index.php
#basic/web/index.php
class_name
:
TestGuy
class_name
:
FunctionalTester
modules
:
modules
:
enabled
:
enabled
:
-
Filesystem
-
Filesystem
...
...
apps/advanced/tests/codeception/backend/functional/LoginCept.php
View file @
cef430af
<?php
<?php
use
codeception_backend\
TestGuy
;
use
codeception_backend\
FunctionalTester
;
use
codeception\common\_pages\LoginPage
;
use
codeception\common\_pages\LoginPage
;
$I
=
new
TestGuy
(
$scenario
);
$I
=
new
FunctionalTester
(
$scenario
);
$I
->
wantTo
(
'ensure login page works'
);
$I
->
wantTo
(
'ensure login page works'
);
$loginPage
=
LoginPage
::
openBy
(
$I
);
$loginPage
=
LoginPage
::
openBy
(
$I
);
...
...
apps/advanced/tests/codeception/backend/unit.suite.yml
View file @
cef430af
...
@@ -3,4 +3,4 @@
...
@@ -3,4 +3,4 @@
# suite for unit (internal) tests.
# suite for unit (internal) tests.
# RUN `build` COMMAND AFTER ADDING/REMOVING MODULES.
# RUN `build` COMMAND AFTER ADDING/REMOVING MODULES.
class_name
:
CodeGuy
class_name
:
UnitTester
apps/advanced/tests/codeception/common/.gitignore
View file @
cef430af
# these files are auto generated by codeception build
# these files are auto generated by codeception build
/unit/
CodeGuy
.php
/unit/
UnitTester
.php
/functional/
TestGuy
.php
/functional/
FunctionalTester
.php
/acceptance/
WebGuy
.php
/acceptance/
AcceptanceTester
.php
apps/advanced/tests/codeception/common/_pages/LoginPage.php
View file @
cef430af
...
@@ -4,6 +4,10 @@ namespace codeception\common\_pages;
...
@@ -4,6 +4,10 @@ namespace codeception\common\_pages;
use
yii\codeception\BasePage
;
use
yii\codeception\BasePage
;
/**
* Represents loging page
* @property \codeception_frontend\AcceptanceTester|\codeception_frontend\FunctionalTester|\codeception_backend\AcceptanceTester|\codeception_backend\FunctionalTester $actor
*/
class
LoginPage
extends
BasePage
class
LoginPage
extends
BasePage
{
{
public
$route
=
'site/login'
;
public
$route
=
'site/login'
;
...
@@ -14,8 +18,8 @@ class LoginPage extends BasePage
...
@@ -14,8 +18,8 @@ class LoginPage extends BasePage
*/
*/
public
function
login
(
$username
,
$password
)
public
function
login
(
$username
,
$password
)
{
{
$this
->
guy
->
fillField
(
'input[name="LoginForm[username]"]'
,
$username
);
$this
->
actor
->
fillField
(
'input[name="LoginForm[username]"]'
,
$username
);
$this
->
guy
->
fillField
(
'input[name="LoginForm[password]"]'
,
$password
);
$this
->
actor
->
fillField
(
'input[name="LoginForm[password]"]'
,
$password
);
$this
->
guy
->
click
(
'login-button'
);
$this
->
actor
->
click
(
'login-button'
);
}
}
}
}
apps/advanced/tests/codeception/common/_support/FixtureHelper.php
View file @
cef430af
...
@@ -16,7 +16,7 @@ class FixtureHelper extends Module
...
@@ -16,7 +16,7 @@ class FixtureHelper extends Module
/**
/**
* Redeclare visibility because codeception includes all public methods that not starts from "_"
* Redeclare visibility because codeception includes all public methods that not starts from "_"
* and not excluded by module settings, in
guy
class.
* and not excluded by module settings, in
actor
class.
*/
*/
use
FixtureTrait
{
use
FixtureTrait
{
loadFixtures
as
protected
;
loadFixtures
as
protected
;
...
...
apps/advanced/tests/codeception/common/fixtures/UserFixture.php
View file @
cef430af
...
@@ -4,6 +4,9 @@ namespace codeception\common\fixtures;
...
@@ -4,6 +4,9 @@ namespace codeception\common\fixtures;
use
yii\test\ActiveFixture
;
use
yii\test\ActiveFixture
;
/**
* User fixture
*/
class
UserFixture
extends
ActiveFixture
class
UserFixture
extends
ActiveFixture
{
{
public
$modelClass
=
'common\models\User'
;
public
$modelClass
=
'common\models\User'
;
...
...
apps/advanced/tests/codeception/common/unit.suite.yml
View file @
cef430af
...
@@ -3,4 +3,4 @@
...
@@ -3,4 +3,4 @@
# suite for unit (internal) tests.
# suite for unit (internal) tests.
# RUN `build` COMMAND AFTER ADDING/REMOVING MODULES.
# RUN `build` COMMAND AFTER ADDING/REMOVING MODULES.
class_name
:
CodeGuy
class_name
:
UnitTester
apps/advanced/tests/codeception/common/unit/DbTestCase.php
View file @
cef430af
...
@@ -2,6 +2,9 @@
...
@@ -2,6 +2,9 @@
namespace
codeception\common\unit
;
namespace
codeception\common\unit
;
/**
* @inheritdoc
*/
class
DbTestCase
extends
\yii\codeception\DbTestCase
class
DbTestCase
extends
\yii\codeception\DbTestCase
{
{
public
$appConfig
=
'@codeception/common/unit/_config.php'
;
public
$appConfig
=
'@codeception/common/unit/_config.php'
;
...
...
apps/advanced/tests/codeception/common/unit/TestCase.php
View file @
cef430af
...
@@ -2,6 +2,9 @@
...
@@ -2,6 +2,9 @@
namespace
common\tests\unit
;
namespace
common\tests\unit
;
/**
* @inheritdoc
*/
class
TestCase
extends
\yii\codeception\TestCase
class
TestCase
extends
\yii\codeception\TestCase
{
{
public
$appConfig
=
'@common/tests/unit/_config.php'
;
public
$appConfig
=
'@common/tests/unit/_config.php'
;
...
...
apps/advanced/tests/codeception/common/unit/models/LoginFormTest.php
View file @
cef430af
...
@@ -8,6 +8,9 @@ use Codeception\Specify;
...
@@ -8,6 +8,9 @@ use Codeception\Specify;
use
common\models\LoginForm
;
use
common\models\LoginForm
;
use
codeception\common\fixtures\UserFixture
;
use
codeception\common\fixtures\UserFixture
;
/**
* Login form test
*/
class
LoginFormTest
extends
DbTestCase
class
LoginFormTest
extends
DbTestCase
{
{
...
@@ -75,6 +78,9 @@ class LoginFormTest extends DbTestCase
...
@@ -75,6 +78,9 @@ class LoginFormTest extends DbTestCase
});
});
}
}
/**
* @inheritdoc
*/
public
function
fixtures
()
public
function
fixtures
()
{
{
return
[
return
[
...
...
apps/advanced/tests/codeception/console/.gitignore
View file @
cef430af
# these files are auto generated by codeception build
# these files are auto generated by codeception build
/unit/
CodeGuy
.php
/unit/
UnitTester
.php
apps/advanced/tests/codeception/console/unit.suite.yml
View file @
cef430af
...
@@ -3,4 +3,4 @@
...
@@ -3,4 +3,4 @@
# suite for unit (internal) tests.
# suite for unit (internal) tests.
# RUN `build` COMMAND AFTER ADDING/REMOVING MODULES.
# RUN `build` COMMAND AFTER ADDING/REMOVING MODULES.
class_name
:
CodeGuy
class_name
:
UnitTester
apps/advanced/tests/codeception/console/unit/DbTestCase.php
View file @
cef430af
...
@@ -2,6 +2,9 @@
...
@@ -2,6 +2,9 @@
namespace
console\tests\unit
;
namespace
console\tests\unit
;
/**
* @inheritdoc
*/
class
DbTestCase
extends
\yii\codeception\DbTestCase
class
DbTestCase
extends
\yii\codeception\DbTestCase
{
{
public
$appConfig
=
'@console/tests/unit/_config.php'
;
public
$appConfig
=
'@console/tests/unit/_config.php'
;
...
...
apps/advanced/tests/codeception/console/unit/TestCase.php
View file @
cef430af
...
@@ -2,6 +2,9 @@
...
@@ -2,6 +2,9 @@
namespace
console\tests\unit
;
namespace
console\tests\unit
;
/**
* @inheritdoc
*/
class
TestCase
extends
\yii\codeception\TestCase
class
TestCase
extends
\yii\codeception\TestCase
{
{
public
$appConfig
=
'@console/tests/unit/_config.php'
;
public
$appConfig
=
'@console/tests/unit/_config.php'
;
...
...
apps/advanced/tests/codeception/frontend/.gitignore
View file @
cef430af
# these files are auto generated by codeception build
# these files are auto generated by codeception build
/unit/
CodeGuy
.php
/unit/
UnitTester
.php
/functional/
TestGuy
.php
/functional/
FunctionalTester
.php
/acceptance/
WebGuy
.php
/acceptance/
AcceptanceTester
.php
apps/advanced/tests/codeception/frontend/_pages/AboutPage.php
View file @
cef430af
...
@@ -4,6 +4,10 @@ namespace codeception\frontend\_pages;
...
@@ -4,6 +4,10 @@ namespace codeception\frontend\_pages;
use
yii\codeception\BasePage
;
use
yii\codeception\BasePage
;
/**
* Represents about page
* @property \codeception_frontend\AcceptanceTester|\codeception_frontend\FunctionalTester $actor
*/
class
AboutPage
extends
BasePage
class
AboutPage
extends
BasePage
{
{
public
$route
=
'site/about'
;
public
$route
=
'site/about'
;
...
...
apps/advanced/tests/codeception/frontend/_pages/ContactPage.php
View file @
cef430af
...
@@ -4,6 +4,10 @@ namespace codeception\frontend\_pages;
...
@@ -4,6 +4,10 @@ namespace codeception\frontend\_pages;
use
yii\codeception\BasePage
;
use
yii\codeception\BasePage
;
/**
* Represents contact page
* @property \codeception_frontend\AcceptanceTester|\codeception_frontend\FunctionalTester $actor
*/
class
ContactPage
extends
BasePage
class
ContactPage
extends
BasePage
{
{
public
$route
=
'site/contact'
;
public
$route
=
'site/contact'
;
...
@@ -15,8 +19,8 @@ class ContactPage extends BasePage
...
@@ -15,8 +19,8 @@ class ContactPage extends BasePage
{
{
foreach
(
$contactData
as
$field
=>
$value
)
{
foreach
(
$contactData
as
$field
=>
$value
)
{
$inputType
=
$field
===
'body'
?
'textarea'
:
'input'
;
$inputType
=
$field
===
'body'
?
'textarea'
:
'input'
;
$this
->
guy
->
fillField
(
$inputType
.
'[name="ContactForm['
.
$field
.
']"]'
,
$value
);
$this
->
actor
->
fillField
(
$inputType
.
'[name="ContactForm['
.
$field
.
']"]'
,
$value
);
}
}
$this
->
guy
->
click
(
'contact-button'
);
$this
->
actor
->
click
(
'contact-button'
);
}
}
}
}
apps/advanced/tests/codeception/frontend/_pages/SignupPage.php
View file @
cef430af
...
@@ -4,6 +4,10 @@ namespace codeception\frontend\_pages;
...
@@ -4,6 +4,10 @@ namespace codeception\frontend\_pages;
use
\yii\codeception\BasePage
;
use
\yii\codeception\BasePage
;
/**
* Represents signup page
* @property \codeception_frontend\AcceptanceTester|\codeception_frontend\FunctionalTester $actor
*/
class
SignupPage
extends
BasePage
class
SignupPage
extends
BasePage
{
{
...
@@ -16,8 +20,8 @@ class SignupPage extends BasePage
...
@@ -16,8 +20,8 @@ class SignupPage extends BasePage
{
{
foreach
(
$signupData
as
$field
=>
$value
)
{
foreach
(
$signupData
as
$field
=>
$value
)
{
$inputType
=
$field
===
'body'
?
'textarea'
:
'input'
;
$inputType
=
$field
===
'body'
?
'textarea'
:
'input'
;
$this
->
guy
->
fillField
(
$inputType
.
'[name="SignupForm['
.
$field
.
']"]'
,
$value
);
$this
->
actor
->
fillField
(
$inputType
.
'[name="SignupForm['
.
$field
.
']"]'
,
$value
);
}
}
$this
->
guy
->
click
(
'signup-button'
);
$this
->
actor
->
click
(
'signup-button'
);
}
}
}
}
apps/advanced/tests/codeception/frontend/acceptance.suite.yml
View file @
cef430af
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
# RUN `build` COMMAND AFTER ADDING/REMOVING MODULES.
# RUN `build` COMMAND AFTER ADDING/REMOVING MODULES.
class_name
:
WebGuy
class_name
:
AcceptanceTester
modules
:
modules
:
enabled
:
enabled
:
-
PhpBrowser
-
PhpBrowser
...
...
apps/advanced/tests/codeception/frontend/acceptance/AboutCept.php
View file @
cef430af
<?php
<?php
use
codeception_frontend\
WebGuy
;
use
codeception_frontend\
AcceptanceTester
;
use
codeception\frontend\_pages\AboutPage
;
use
codeception\frontend\_pages\AboutPage
;
$I
=
new
WebGuy
(
$scenario
);
$I
=
new
AcceptanceTester
(
$scenario
);
$I
->
wantTo
(
'ensure that about works'
);
$I
->
wantTo
(
'ensure that about works'
);
AboutPage
::
openBy
(
$I
);
AboutPage
::
openBy
(
$I
);
$I
->
see
(
'About'
,
'h1'
);
$I
->
see
(
'About'
,
'h1'
);
apps/advanced/tests/codeception/frontend/acceptance/ContactCept.php
View file @
cef430af
<?php
<?php
use
codeception_frontend\
WebGuy
;
use
codeception_frontend\
AcceptanceTester
;
use
codeception\frontend\_pages\ContactPage
;
use
codeception\frontend\_pages\ContactPage
;
$I
=
new
WebGuy
(
$scenario
);
$I
=
new
AcceptanceTester
(
$scenario
);
$I
->
wantTo
(
'ensure that contact works'
);
$I
->
wantTo
(
'ensure that contact works'
);
$contactPage
=
ContactPage
::
openBy
(
$I
);
$contactPage
=
ContactPage
::
openBy
(
$I
);
...
...
apps/advanced/tests/codeception/frontend/acceptance/HomeCept.php
View file @
cef430af
<?php
<?php
use
codeception_frontend\
WebGuy
;
use
codeception_frontend\
AcceptanceTester
;
$I
=
new
WebGuy
(
$scenario
);
$I
=
new
AcceptanceTester
(
$scenario
);
$I
->
wantTo
(
'ensure that home page works'
);
$I
->
wantTo
(
'ensure that home page works'
);
$I
->
amOnPage
(
Yii
::
$app
->
homeUrl
);
$I
->
amOnPage
(
Yii
::
$app
->
homeUrl
);
$I
->
see
(
'My Company'
);
$I
->
see
(
'My Company'
);
...
...
apps/advanced/tests/codeception/frontend/acceptance/LoginCept.php
View file @
cef430af
<?php
<?php
use
codeception_frontend\
WebGuy
;
use
codeception_frontend\
AcceptanceTester
;
use
codeception\common\_pages\LoginPage
;
use
codeception\common\_pages\LoginPage
;
$I
=
new
WebGuy
(
$scenario
);
$I
=
new
AcceptanceTester
(
$scenario
);
$I
->
wantTo
(
'ensure login page works'
);
$I
->
wantTo
(
'ensure login page works'
);
$loginPage
=
LoginPage
::
openBy
(
$I
);
$loginPage
=
LoginPage
::
openBy
(
$I
);
...
...
apps/advanced/tests/codeception/frontend/acceptance/SignupCest.php
View file @
cef430af
...
@@ -10,7 +10,7 @@ class SignupCest
...
@@ -10,7 +10,7 @@ class SignupCest
/**
/**
* This method is called before each cest class test method
* This method is called before each cest class test method
* @param \Codeception\Event\Test $event
* @param \Codeception\Event\Test
Event
$event
*/
*/
public
function
_before
(
$event
)
public
function
_before
(
$event
)
{
{
...
@@ -18,7 +18,7 @@ class SignupCest
...
@@ -18,7 +18,7 @@ class SignupCest
/**
/**
* This method is called after each cest class test method, even if test failed.
* This method is called after each cest class test method, even if test failed.
* @param \Codeception\Event\Test $event
* @param \Codeception\Event\Test
Event
$event
*/
*/
public
function
_after
(
$event
)
public
function
_after
(
$event
)
{
{
...
@@ -30,14 +30,14 @@ class SignupCest
...
@@ -30,14 +30,14 @@ class SignupCest
/**
/**
* This method is called when test fails.
* This method is called when test fails.
* @param \Codeception\Event\Fail $event
* @param \Codeception\Event\Fail
Event
$event
*/
*/
public
function
_fail
(
$event
)
public
function
_fail
(
$event
)
{
{
}
}
/**
/**
* @param \
WebGuy
$I
* @param \
codeception_frontend\AcceptanceTester
$I
* @param \Codeception\Scenario $scenario
* @param \Codeception\Scenario $scenario
*/
*/
public
function
testUserSignup
(
$I
,
$scenario
)
public
function
testUserSignup
(
$I
,
$scenario
)
...
...
apps/advanced/tests/codeception/frontend/functional.suite.yml
View file @
cef430af
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
# RUN `build` COMMAND AFTER ADDING/REMOVING MODULES.
# RUN `build` COMMAND AFTER ADDING/REMOVING MODULES.
#basic/web/index.php
#basic/web/index.php
class_name
:
TestGuy
class_name
:
FunctionalTester
modules
:
modules
:
enabled
:
enabled
:
-
Filesystem
-
Filesystem
...
...
apps/advanced/tests/codeception/frontend/functional/AboutCept.php
View file @
cef430af
<?php
<?php
use
codeception_frontend\
TestGuy
;
use
codeception_frontend\
FunctionalTester
;
use
codeception\frontend\_pages\AboutPage
;
use
codeception\frontend\_pages\AboutPage
;
$I
=
new
TestGuy
(
$scenario
);
$I
=
new
FunctionalTester
(
$scenario
);
$I
->
wantTo
(
'ensure that about works'
);
$I
->
wantTo
(
'ensure that about works'
);
AboutPage
::
openBy
(
$I
);
AboutPage
::
openBy
(
$I
);
$I
->
see
(
'About'
,
'h1'
);
$I
->
see
(
'About'
,
'h1'
);
apps/advanced/tests/codeception/frontend/functional/ContactCept.php
View file @
cef430af
<?php
<?php
use
codeception_frontend\
TestGuy
;
use
codeception_frontend\
FunctionalTester
;
use
codeception\frontend\_pages\ContactPage
;
use
codeception\frontend\_pages\ContactPage
;
$I
=
new
TestGuy
(
$scenario
);
$I
=
new
FunctionalTester
(
$scenario
);
$I
->
wantTo
(
'ensure that contact works'
);
$I
->
wantTo
(
'ensure that contact works'
);
$contactPage
=
ContactPage
::
openBy
(
$I
);
$contactPage
=
ContactPage
::
openBy
(
$I
);
...
...
apps/advanced/tests/codeception/frontend/functional/HomeCept.php
View file @
cef430af
<?php
<?php
use
codeception_frontend\
TestGuy
;
use
codeception_frontend\
FunctionalTester
;
$I
=
new
TestGuy
(
$scenario
);
$I
=
new
FunctionalTester
(
$scenario
);
$I
->
wantTo
(
'ensure that home page works'
);
$I
->
wantTo
(
'ensure that home page works'
);
$I
->
amOnPage
(
Yii
::
$app
->
homeUrl
);
$I
->
amOnPage
(
Yii
::
$app
->
homeUrl
);
$I
->
see
(
'My Company'
);
$I
->
see
(
'My Company'
);
...
...
apps/advanced/tests/codeception/frontend/functional/LoginCept.php
View file @
cef430af
<?php
<?php
use
codeception_frontend\
TestGuy
;
use
codeception_frontend\
FunctionalTester
;
use
codeception\common\_pages\LoginPage
;
use
codeception\common\_pages\LoginPage
;
$I
=
new
TestGuy
(
$scenario
);
$I
=
new
FunctionalTester
(
$scenario
);
$I
->
wantTo
(
'ensure login page works'
);
$I
->
wantTo
(
'ensure login page works'
);
$loginPage
=
LoginPage
::
openBy
(
$I
);
$loginPage
=
LoginPage
::
openBy
(
$I
);
...
...
apps/advanced/tests/codeception/frontend/functional/SignupCest.php
View file @
cef430af
...
@@ -10,7 +10,7 @@ class SignupCest
...
@@ -10,7 +10,7 @@ class SignupCest
/**
/**
* This method is called before each cest class test method
* This method is called before each cest class test method
* @param \Codeception\Event\Test $event
* @param \Codeception\Event\Test
Event
$event
*/
*/
public
function
_before
(
$event
)
public
function
_before
(
$event
)
{
{
...
@@ -18,7 +18,7 @@ class SignupCest
...
@@ -18,7 +18,7 @@ class SignupCest
/**
/**
* This method is called after each cest class test method, even if test failed.
* This method is called after each cest class test method, even if test failed.
* @param \Codeception\Event\Test $event
* @param \Codeception\Event\Test
Event
$event
*/
*/
public
function
_after
(
$event
)
public
function
_after
(
$event
)
{
{
...
@@ -30,7 +30,7 @@ class SignupCest
...
@@ -30,7 +30,7 @@ class SignupCest
/**
/**
* This method is called when test fails.
* This method is called when test fails.
* @param \Codeception\Event\Fail $event
* @param \Codeception\Event\Fail
Event
$event
*/
*/
public
function
_fail
(
$event
)
public
function
_fail
(
$event
)
{
{
...
@@ -39,7 +39,7 @@ class SignupCest
...
@@ -39,7 +39,7 @@ class SignupCest
/**
/**
*
*
* @param \
TestGuy
$I
* @param \
codeception_frontend\FunctionalTester
$I
* @param \Codeception\Scenario $scenario
* @param \Codeception\Scenario $scenario
*/
*/
public
function
testUserSignup
(
$I
,
$scenario
)
public
function
testUserSignup
(
$I
,
$scenario
)
...
...
apps/advanced/tests/codeception/frontend/unit.suite.yml
View file @
cef430af
...
@@ -3,4 +3,4 @@
...
@@ -3,4 +3,4 @@
# suite for unit (internal) tests.
# suite for unit (internal) tests.
# RUN `build` COMMAND AFTER ADDING/REMOVING MODULES.
# RUN `build` COMMAND AFTER ADDING/REMOVING MODULES.
class_name
:
CodeGuy
class_name
:
UnitTester
apps/advanced/tests/codeception/frontend/unit/DbTestCase.php
View file @
cef430af
...
@@ -2,6 +2,9 @@
...
@@ -2,6 +2,9 @@
namespace
codeception\frontend\unit
;
namespace
codeception\frontend\unit
;
/**
* @inheritdoc
*/
class
DbTestCase
extends
\yii\codeception\DbTestCase
class
DbTestCase
extends
\yii\codeception\DbTestCase
{
{
public
$appConfig
=
'@codeception/frontend/unit/_config.php'
;
public
$appConfig
=
'@codeception/frontend/unit/_config.php'
;
...
...
apps/advanced/tests/codeception/frontend/unit/TestCase.php
View file @
cef430af
...
@@ -2,6 +2,9 @@
...
@@ -2,6 +2,9 @@
namespace
codeception\frontend\unit
;
namespace
codeception\frontend\unit
;
/**
* @inheritdoc
*/
class
TestCase
extends
\yii\codeception\TestCase
class
TestCase
extends
\yii\codeception\TestCase
{
{
public
$appConfig
=
'@codeception/frontend/unit/_config.php'
;
public
$appConfig
=
'@codeception/frontend/unit/_config.php'
;
...
...
apps/basic/tests/codeception/.gitignore
View file @
cef430af
# these files are auto generated by codeception build
# these files are auto generated by codeception build
/unit/
CodeGuy
.php
/unit/
UnitTester
.php
/functional/
TestGuy
.php
/functional/
FunctionalTester
.php
/acceptance/
WebGuy
.php
/acceptance/
AcceptanceTester
.php
apps/basic/tests/codeception/_pages/AboutPage.php
View file @
cef430af
...
@@ -4,6 +4,10 @@ namespace codeception\_pages;
...
@@ -4,6 +4,10 @@ namespace codeception\_pages;
use
yii\codeception\BasePage
;
use
yii\codeception\BasePage
;
/**
* Represents about page
* @property \AcceptanceTester|\FunctionalTester $actor
*/
class
AboutPage
extends
BasePage
class
AboutPage
extends
BasePage
{
{
public
$route
=
'site/about'
;
public
$route
=
'site/about'
;
...
...
apps/basic/tests/codeception/_pages/ContactPage.php
View file @
cef430af
...
@@ -4,6 +4,10 @@ namespace codeception\_pages;
...
@@ -4,6 +4,10 @@ namespace codeception\_pages;
use
yii\codeception\BasePage
;
use
yii\codeception\BasePage
;
/**
* Represents contact page
* @property \AcceptanceTester|\FunctionalTester $actor
*/
class
ContactPage
extends
BasePage
class
ContactPage
extends
BasePage
{
{
public
$route
=
'site/contact'
;
public
$route
=
'site/contact'
;
...
@@ -15,8 +19,8 @@ class ContactPage extends BasePage
...
@@ -15,8 +19,8 @@ class ContactPage extends BasePage
{
{
foreach
(
$contactData
as
$field
=>
$value
)
{
foreach
(
$contactData
as
$field
=>
$value
)
{
$inputType
=
$field
===
'body'
?
'textarea'
:
'input'
;
$inputType
=
$field
===
'body'
?
'textarea'
:
'input'
;
$this
->
guy
->
fillField
(
$inputType
.
'[name="ContactForm['
.
$field
.
']"]'
,
$value
);
$this
->
actor
->
fillField
(
$inputType
.
'[name="ContactForm['
.
$field
.
']"]'
,
$value
);
}
}
$this
->
guy
->
click
(
'contact-button'
);
$this
->
actor
->
click
(
'contact-button'
);
}
}
}
}
apps/basic/tests/codeception/_pages/LoginPage.php
View file @
cef430af
...
@@ -4,6 +4,10 @@ namespace codeception\_pages;
...
@@ -4,6 +4,10 @@ namespace codeception\_pages;
use
yii\codeception\BasePage
;
use
yii\codeception\BasePage
;
/**
* Represents login page
* @property \AcceptanceTester|\FunctionalTester $actor
*/
class
LoginPage
extends
BasePage
class
LoginPage
extends
BasePage
{
{
public
$route
=
'site/login'
;
public
$route
=
'site/login'
;
...
@@ -14,8 +18,8 @@ class LoginPage extends BasePage
...
@@ -14,8 +18,8 @@ class LoginPage extends BasePage
*/
*/
public
function
login
(
$username
,
$password
)
public
function
login
(
$username
,
$password
)
{
{
$this
->
guy
->
fillField
(
'input[name="LoginForm[username]"]'
,
$username
);
$this
->
actor
->
fillField
(
'input[name="LoginForm[username]"]'
,
$username
);
$this
->
guy
->
fillField
(
'input[name="LoginForm[password]"]'
,
$password
);
$this
->
actor
->
fillField
(
'input[name="LoginForm[password]"]'
,
$password
);
$this
->
guy
->
click
(
'login-button'
);
$this
->
actor
->
click
(
'login-button'
);
}
}
}
}
apps/basic/tests/codeception/acceptance.suite.yml
View file @
cef430af
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
# RUN `build` COMMAND AFTER ADDING/REMOVING MODULES.
# RUN `build` COMMAND AFTER ADDING/REMOVING MODULES.
class_name
:
WebGuy
class_name
:
AcceptanceTester
modules
:
modules
:
enabled
:
enabled
:
-
PhpBrowser
-
PhpBrowser
...
...
apps/basic/tests/codeception/acceptance/AboutCept.php
View file @
cef430af
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
use
codeception\_pages\AboutPage
;
use
codeception\_pages\AboutPage
;
$I
=
new
WebGuy
(
$scenario
);
$I
=
new
AcceptanceTester
(
$scenario
);
$I
->
wantTo
(
'ensure that about works'
);
$I
->
wantTo
(
'ensure that about works'
);
AboutPage
::
openBy
(
$I
);
AboutPage
::
openBy
(
$I
);
$I
->
see
(
'About'
,
'h1'
);
$I
->
see
(
'About'
,
'h1'
);
apps/basic/tests/codeception/acceptance/ContactCept.php
View file @
cef430af
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
use
codeception\_pages\ContactPage
;
use
codeception\_pages\ContactPage
;
$I
=
new
WebGuy
(
$scenario
);
$I
=
new
AcceptanceTester
(
$scenario
);
$I
->
wantTo
(
'ensure that contact works'
);
$I
->
wantTo
(
'ensure that contact works'
);
$contactPage
=
ContactPage
::
openBy
(
$I
);
$contactPage
=
ContactPage
::
openBy
(
$I
);
...
...
apps/basic/tests/codeception/acceptance/HomeCept.php
View file @
cef430af
<?php
<?php
$I
=
new
WebGuy
(
$scenario
);
$I
=
new
AcceptanceTester
(
$scenario
);
$I
->
wantTo
(
'ensure that home page works'
);
$I
->
wantTo
(
'ensure that home page works'
);
$I
->
amOnPage
(
Yii
::
$app
->
homeUrl
);
$I
->
amOnPage
(
Yii
::
$app
->
homeUrl
);
$I
->
see
(
'My Company'
);
$I
->
see
(
'My Company'
);
...
...
apps/basic/tests/codeception/acceptance/LoginCept.php
View file @
cef430af
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
use
codeception\_pages\LoginPage
;
use
codeception\_pages\LoginPage
;
$I
=
new
WebGuy
(
$scenario
);
$I
=
new
AcceptanceTester
(
$scenario
);
$I
->
wantTo
(
'ensure that login works'
);
$I
->
wantTo
(
'ensure that login works'
);
$loginPage
=
LoginPage
::
openBy
(
$I
);
$loginPage
=
LoginPage
::
openBy
(
$I
);
...
...
apps/basic/tests/codeception/functional.suite.yml
View file @
cef430af
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
# RUN `build` COMMAND AFTER ADDING/REMOVING MODULES.
# RUN `build` COMMAND AFTER ADDING/REMOVING MODULES.
#basic/web/index.php
#basic/web/index.php
class_name
:
TestGuy
class_name
:
FunctionalTester
modules
:
modules
:
enabled
:
enabled
:
-
Filesystem
-
Filesystem
...
...
apps/basic/tests/codeception/functional/AboutCept.php
View file @
cef430af
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
use
codeception\_pages\AboutPage
;
use
codeception\_pages\AboutPage
;
$I
=
new
TestGuy
(
$scenario
);
$I
=
new
FunctionalTester
(
$scenario
);
$I
->
wantTo
(
'ensure that about works'
);
$I
->
wantTo
(
'ensure that about works'
);
AboutPage
::
openBy
(
$I
);
AboutPage
::
openBy
(
$I
);
$I
->
see
(
'About'
,
'h1'
);
$I
->
see
(
'About'
,
'h1'
);
apps/basic/tests/codeception/functional/ContactCept.php
View file @
cef430af
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
use
codeception\_pages\ContactPage
;
use
codeception\_pages\ContactPage
;
$I
=
new
TestGuy
(
$scenario
);
$I
=
new
FunctionalTester
(
$scenario
);
$I
->
wantTo
(
'ensure that contact works'
);
$I
->
wantTo
(
'ensure that contact works'
);
$contactPage
=
ContactPage
::
openBy
(
$I
);
$contactPage
=
ContactPage
::
openBy
(
$I
);
...
...
apps/basic/tests/codeception/functional/HomeCept.php
View file @
cef430af
<?php
<?php
$I
=
new
TestGuy
(
$scenario
);
$I
=
new
FunctionalTester
(
$scenario
);
$I
->
wantTo
(
'ensure that home page works'
);
$I
->
wantTo
(
'ensure that home page works'
);
$I
->
amOnPage
(
Yii
::
$app
->
homeUrl
);
$I
->
amOnPage
(
Yii
::
$app
->
homeUrl
);
$I
->
see
(
'My Company'
);
$I
->
see
(
'My Company'
);
...
...
apps/basic/tests/codeception/functional/LoginCept.php
View file @
cef430af
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
use
codeception\_pages\LoginPage
;
use
codeception\_pages\LoginPage
;
$I
=
new
TestGuy
(
$scenario
);
$I
=
new
FunctionalTester
(
$scenario
);
$I
->
wantTo
(
'ensure that login works'
);
$I
->
wantTo
(
'ensure that login works'
);
$loginPage
=
LoginPage
::
openBy
(
$I
);
$loginPage
=
LoginPage
::
openBy
(
$I
);
...
...
apps/basic/tests/codeception/unit.suite.yml
View file @
cef430af
...
@@ -3,4 +3,4 @@
...
@@ -3,4 +3,4 @@
# suite for unit (internal) tests.
# suite for unit (internal) tests.
# RUN `build` COMMAND AFTER ADDING/REMOVING MODULES.
# RUN `build` COMMAND AFTER ADDING/REMOVING MODULES.
class_name
:
CodeGuy
class_name
:
UnitTester
extensions/codeception/BasePage.php
View file @
cef430af
...
@@ -29,19 +29,19 @@ abstract class BasePage extends Component
...
@@ -29,19 +29,19 @@ abstract class BasePage extends Component
public
$route
;
public
$route
;
/**
/**
* @var \Codeception\A
bstractGuy
the testing guy object
* @var \Codeception\A
ctor
the testing guy object
*/
*/
protected
$
guy
;
protected
$
actor
;
/**
/**
* Constructor.
* Constructor.
*
*
* @param \Codeception\A
bstractGuy
$I the testing guy object
* @param \Codeception\A
ctor
$I the testing guy object
*/
*/
public
function
__construct
(
$I
)
public
function
__construct
(
$I
)
{
{
$this
->
guy
=
$I
;
$this
->
actor
=
$I
;
}
}
/**
/**
...
@@ -67,7 +67,7 @@ abstract class BasePage extends Component
...
@@ -67,7 +67,7 @@ abstract class BasePage extends Component
/**
/**
* Creates a page instance and sets the test guy to use [[url]].
* Creates a page instance and sets the test guy to use [[url]].
* @param \Codeception\A
bstractGuy
$I the test guy instance
* @param \Codeception\A
ctor
$I the test guy instance
* @param array $params the GET parameters to be used to generate [[url]]
* @param array $params the GET parameters to be used to generate [[url]]
* @return static the page instance
* @return static the page instance
*/
*/
...
...
extensions/codeception/DbTestCase.php
View file @
cef430af
...
@@ -10,6 +10,8 @@ namespace yii\codeception;
...
@@ -10,6 +10,8 @@ namespace yii\codeception;
use
yii\test\InitDbFixture
;
use
yii\test\InitDbFixture
;
/**
/**
* Base class for database test cases
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
* @since 2.0
*/
*/
...
...
extensions/codeception/README.md
View file @
cef430af
...
@@ -52,11 +52,11 @@ If you want to use codeception modules and helpers in your unit tests, you can d
...
@@ -52,11 +52,11 @@ If you want to use codeception modules and helpers in your unit tests, you can d
$this
->
getModule
(
'CodeHelper'
);
#or some other module
$this
->
getModule
(
'CodeHelper'
);
#or some other module
```
```
You also can use all
guy methods by accessing guy
instance like:
You also can use all
actor methods by accessing actor
instance like:
```
php
```
php
<?php
<?php
$this
->
codeGuy
->
someMethodFromModule
();
$this
->
unitTester
->
someMethodFromModule
();
```
```
Codeception events
Codeception events
------------------
------------------
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment