Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
planck-aye
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
codename
planck-aye
Commits
89c9a125
Commit
89c9a125
authored
Jan 01, 2017
by
Tobias Munk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated & fixed tests
parent
bb2f45b4
Changes
24
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
462 additions
and
22 deletions
+462
-22
.gitignore
.gitignore
+1
-0
codeception.yml
tests/codeception.yml
+4
-5
_bootstrap.php
tests/codeception/_bootstrap.php
+1
-1
m160720_000000_demo_data.php
...codeception/_migrations/data/m160720_000000_demo_data.php
+8
-0
m160721_000000_users_and_auth.php
...eption/_migrations/data/m160721_000000_users_and_auth.php
+8
-0
m160721_000000_users_and_auth.sql
...eption/_migrations/data/m160721_000000_users_and_auth.sql
+46
-0
m161215_183747_app_0.8.2-1-ga18d13a_data.sql
...rations/data/m161215_183747_app_0.8.2-1-ga18d13a_data.sql
+164
-0
E2eTester.php
tests/codeception/_support/E2eTester.php
+1
-1
Acceptance.php
tests/codeception/_support/Helper/Acceptance.php
+10
-0
Cli.php
tests/codeception/_support/Helper/Cli.php
+10
-0
E2e.php
tests/codeception/_support/Helper/E2e.php
+10
-0
Functional.php
tests/codeception/_support/Helper/Functional.php
+10
-0
Unit.php
tests/codeception/_support/Helper/Unit.php
+10
-0
e2e.suite.yml
tests/codeception/e2e.suite.yml
+27
-2
AccessControlCept.php
tests/codeception/functional/AccessControlCept.php
+26
-0
AccessControlUICept.php
tests/codeception/functional/AccessControlUICept.php
+16
-0
BackendLinksCept.php
tests/codeception/functional/BackendLinksCept.php
+29
-0
ErrorPageCept.php
tests/codeception/functional/ErrorPageCept.php
+10
-0
LanguagesCept.php
tests/codeception/functional/LanguagesCept.php
+24
-0
LoginCept.php
tests/codeception/functional/LoginCept.php
+6
-4
VersionCept.php
tests/codeception/functional/VersionCept.php
+17
-0
_bootstrap.php
tests/codeception/functional/_bootstrap.php
+0
-2
ControllerTest.php
tests/codeception/unit/ControllerTest.php
+3
-7
UserTest.php
tests/codeception/unit/UserTest.php
+21
-0
No files found.
.gitignore
View file @
89c9a125
...
...
@@ -11,3 +11,4 @@ web/bundles
docker-compose.override.yml
tests/codeception/_output
tests/codeception/_support/_generated
tests/codeception.yml
View file @
89c9a125
...
...
@@ -6,6 +6,7 @@ paths:
support
:
codeception/_support
envs
:
codeception/_envs
settings
:
#shuffle: true
bootstrap
:
_bootstrap.php
colors
:
true
memory_limit
:
1024M
...
...
@@ -14,11 +15,9 @@ extensions:
-
Codeception\Extension\RunFailed
modules
:
config
:
Db
:
dsn
:
'
'
user
:
'
'
password
:
'
'
dump
:
codeception/_data/dump.sql
Yii2
:
configFile
:
'
codeception/_config/codeception-module.php'
cleanup
:
false
config
:
test_entry_url
:
http://web:80/index.php
coverage
:
...
...
tests/codeception/_bootstrap.php
View file @
89c9a125
...
...
@@ -9,7 +9,7 @@ require($rootPath.'/src/config/env.php');
# TODO: review run webserver in YII_ENV=prod for acceptance tests, yii2-localurls has redirect issues in YII_ENV=test, see https://github.com/codemix/yii2-localeurls/issues/62
if
(
php_sapi_name
()
==
'cli'
&&
getenv
(
'YII_ENV'
)
!==
'test'
)
{
echo
"Error: YII_ENV must be set to 'test'
\n
"
;
exit
;
exit
(
1
)
;
}
defined
(
'YII_DEBUG'
)
or
define
(
'YII_DEBUG'
,
true
);
...
...
tests/codeception/_migrations/data/m160720_000000_demo_data.php
0 → 100644
View file @
89c9a125
<?php
use
yii\db\Migration
;
class
m160720_000000_demo_data
extends
\dmstr\db\mysql\FileMigration
{
public
$file
=
'm161215_183747_app_0.8.2-1-ga18d13a_data.sql'
;
}
tests/codeception/_migrations/data/m160721_000000_users_and_auth.php
0 → 100644
View file @
89c9a125
<?php
use
yii\db\Migration
;
class
m160721_000000_users_and_auth
extends
\dmstr\db\mysql\FileMigration
{
}
tests/codeception/_migrations/data/m160721_000000_users_and_auth.sql
0 → 100644
View file @
89c9a125
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */
;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */
;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */
;
/*!40101 SET NAMES utf8 */
;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */
;
/*!40103 SET TIME_ZONE='+00:00' */
;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */
;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */
;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */
;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */
;
TRUNCATE
table
`app_auth_assignment`
;
TRUNCATE
table
`app_profile`
;
TRUNCATE
table
`app_user`
;
TRUNCATE
table
`app_social_account`
;
INSERT
INTO
`app_user`
(
`id`
,
`username`
,
`email`
,
`password_hash`
,
`auth_key`
,
`confirmed_at`
,
`unconfirmed_email`
,
`blocked_at`
,
`registration_ip`
,
`created_at`
,
`updated_at`
,
`flags`
)
VALUES
(
1
,
'admin'
,
'admin@h17n.de'
,
'$2y$10$uN98TVi0OytDDgcpENV7IOWlWemn2TD/vij5hoN2QbZ/P8iGQkafy'
,
'ArSNskfLRoiDivKY98jaqgORDj597si4'
,
1463058272
,
NULL
,
NULL
,
NULL
,
1463058272
,
1475855889
,
0
),
(
2
,
'dev'
,
'dev@h17n.de'
,
'$2y$10$8jo5HglYhJSgrl4iVVPSk.4pU3MOYSeyn1.jmtBgp0v3tRcQrtC1i'
,
'33KED5Gw27sCnL3QyFe9svkaXL4pJUCx'
,
1463352048
,
NULL
,
NULL
,
'54.93.102.17'
,
1463349160
,
1478617300
,
0
),
(
3
,
'editor'
,
'editor@h17n.de'
,
'$2y$10$WzJWeCyCZi2n8w2nXIMbU.K7lJB8iMINcZIMutarHZ50qAGXsGIwy'
,
'HK7L1cW7VrpMGgvhHaQBnZGDu8zquCyM'
,
1467318745
,
NULL
,
NULL
,
'54.93.102.17'
,
1467318664
,
1478617291
,
0
),
(
4
,
'preview'
,
'preview@h17n.de'
,
'$2y$10$rfmrfvct3wD3akoVZY3l5OSidJ0xKMcoKeVlZZHfvT8fVZ4RYYj6m'
,
'WgWxMQCOMEyYgDDJ_mCBJcxvyL6h6SyI'
,
1467331347
,
NULL
,
NULL
,
'54.93.102.17'
,
1467331347
,
1469693262
,
0
);
INSERT
INTO
`app_profile`
(
`user_id`
,
`name`
,
`public_email`
,
`gravatar_email`
,
`gravatar_id`
,
`location`
,
`website`
,
`bio`
,
`timezone`
)
VALUES
(
1
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
),
(
2
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
),
(
3
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
),
(
4
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
);
LOCK
TABLES
`app_auth_assignment`
WRITE
;
TRUNCATE
TABLE
`app_auth_assignment`
;
/*!40000 ALTER TABLE `app_auth_assignment` DISABLE KEYS */
;
INSERT
INTO
`app_auth_assignment`
VALUES
(
'Developer'
,
'2'
,
1467315311
),(
'Editor'
,
'3'
,
1467318765
),(
'Preview'
,
'4'
,
1467331484
);
/*!40000 ALTER TABLE `app_auth_assignment` ENABLE KEYS */
;
UNLOCK
TABLES
;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */
;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */
;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */
;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */
;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */
;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */
;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */
;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */
;
tests/codeception/_migrations/data/m161215_183747_app_0.8.2-1-ga18d13a_data.sql
0 → 100644
View file @
89c9a125
This diff is collapsed.
Click to expand it.
tests/codeception/_support/E2eTester.php
View file @
89c9a125
...
...
@@ -28,7 +28,7 @@ class E2eTester extends \Codeception\Actor
$this
->
fillField
(
'input[name="login-form[login]"]'
,
$username
);
$this
->
fillField
(
'input[name="login-form[password]"]'
,
$password
);
$this
->
click
(
'#login-form button'
);
$this
->
waitForElementNotVisible
(
'#login-form'
,
5
);
$this
->
waitForElementNotVisible
(
'#login-form'
,
10
);
}
public
function
dontSeeHorizontalScrollbars
(){
...
...
tests/codeception/_support/Helper/Acceptance.php
0 → 100755
View file @
89c9a125
<?php
namespace
Helper
;
// here you can define custom actions
// all public methods declared in helper class will be available in $I
class
Acceptance
extends
\Codeception\Module
{
}
tests/codeception/_support/Helper/Cli.php
0 → 100755
View file @
89c9a125
<?php
namespace
Helper
;
// here you can define custom actions
// all public methods declared in helper class will be available in $I
class
Cli
extends
\Codeception\Module
{
}
tests/codeception/_support/Helper/E2e.php
0 → 100755
View file @
89c9a125
<?php
namespace
Helper
;
// here you can define custom actions
// all public methods declared in helper class will be available in $I
class
E2e
extends
\Codeception\Module
{
}
tests/codeception/_support/Helper/Functional.php
0 → 100755
View file @
89c9a125
<?php
namespace
Helper
;
// here you can define custom actions
// all public methods declared in helper class will be available in $I
class
Functional
extends
\Codeception\Module
{
}
tests/codeception/_support/Helper/Unit.php
0 → 100755
View file @
89c9a125
<?php
namespace
Helper
;
// here you can define custom actions
// all public methods declared in helper class will be available in $I
class
Unit
extends
\Codeception\Module
{
}
tests/codeception/e2e.suite.yml
View file @
89c9a125
class_name
:
E2eTester
modules
:
enabled
:
#
- \Helper\E2e
-
\Helper\E2e
-
WebDriver
-
Asserts
config
:
WebDriver
:
browser
:
firefox
host
:
firefox
port
:
4444
window_size
:
1024x768
restart
:
true
url
:
http://web:80/
env
:
firefox
:
modules
:
config
:
WebDriver
:
browser
:
firefox
port
:
4444
host
:
firefox
# Can be configured as Docker selenium container
chrome
:
modules
:
config
:
WebDriver
:
browser
:
chrome
host
:
chrome
# Can be configured from modern.ie and selenium java standalone driver
ie
:
modules
:
config
:
WebDriver
:
browser
:
'
internet
explorer'
host
:
192.168.99.1
port
:
14444
window_size
:
1024x768
restart
:
true
url
:
http://192.168.99.1:32779/
tests/codeception/functional/AccessControlCept.php
0 → 100755
View file @
89c9a125
<?php
// @group mandatory
$I
=
new
FunctionalTester
(
$scenario
);
$I
->
wantTo
(
'ensure that access control works'
);
$routesWithAccessControl
=
[
'/backend'
,
'/backend/default/view-config'
,
'/prototype'
,
'/prototype/html'
,
'/prototype/less'
,
'/prototype/less/create'
,
'/settings'
,
'/settings/default/create'
,
'/translatemanager'
,
'/rbac'
,
'/user'
,
'/pages'
];
foreach
(
$routesWithAccessControl
AS
$route
)
{
$I
->
amOnPage
(
$route
);
$I
->
canSeeCurrentUrlMatches
(
'|user/login|'
);
}
tests/codeception/functional/AccessControlUICept.php
0 → 100755
View file @
89c9a125
<?php
// @group mandatory
use
tests\codeception\_pages\LoginPage
;
$I
=
new
FunctionalTester
(
$scenario
);
$I
->
wantTo
(
'ensure that access control UI works'
);
$I
->
amOnPage
(
'/'
);
$I
->
dontSeeLink
(
'/de/backend'
,
'.nav'
);
$I
->
dontSee
(
''
,
'.glyphicon.glyphicon-cog'
);
$I
->
login
(
'admin'
,
'admin1'
);
$I
->
see
(
''
,
'.glyphicon.glyphicon-cog'
);
tests/codeception/functional/BackendLinksCept.php
0 → 100644
View file @
89c9a125
<?php
// @group mandatory
$I
=
new
FunctionalTester
(
$scenario
);
$I
->
wantTo
(
'Click backend links'
);
$I
->
amGoingTo
(
'start in the backend'
);
$I
->
login
(
'admin'
,
'admin1'
);
$url
=
'/backend'
;
$I
->
amOnPage
(
$url
);
$links
=
$I
->
grabMultiple
(
'section.content a[href^="/"]'
,
'href'
);
foreach
(
$links
as
$i
=>
$url
)
{
switch
(
$url
)
{
case
'/debug'
:
case
'/treemanager'
:
continue
2
;
break
;
}
$I
->
amGoingTo
(
'check '
.
$url
);
$I
->
amOnPage
(
$url
);
$I
->
cantSeeElement
(
'.site-error'
);
$I
->
cantSeeElement
(
'.alert-warning .alert'
);
}
tests/codeception/functional/ErrorPageCept.php
0 → 100755
View file @
89c9a125
<?php
// @group mandatory
$I
=
new
FunctionalTester
(
$scenario
);
$I
->
wantTo
(
'ensure that error page works'
);
$I
->
amOnPage
(
'/_this_page_does_not_exist_'
);
$I
->
seeResponseCodeIs
(
404
);
$I
->
see
(
'Not Found'
);
tests/codeception/functional/LanguagesCept.php
0 → 100755
View file @
89c9a125
<?php
// @group mandatory
use
tests\codeception\_pages\LoginPage
;
$I
=
new
FunctionalTester
(
$scenario
);
$I
->
wantTo
(
'ensure that language urls work'
);
$I
->
expect
(
'a 404 error for a non-existant language'
);
$I
->
amOnPage
(
'/xx'
);
$I
->
canSeeResponseCodeIs
(
404
);
$I
->
expect
(
'a redirect if no language is set'
);
$I
->
amOnPage
(
'/'
);
$I
->
canSeeResponseCodeIs
(
200
);
$I
->
amOnPage
(
'/de'
);
$I
->
canSeeResponseCodeIs
(
200
);
$I
->
amOnPage
(
'/en'
);
$I
->
canSeeResponseCodeIs
(
200
);
// Note: extended redirect testing needs to be run in acceptance tests
tests/codeception/functional/LoginCept.php
View file @
89c9a125
...
...
@@ -29,7 +29,9 @@ $I->seeResponseCodeIs(200);
$I
->
expectTo
(
'see backend elements'
);
$I
->
see
(
'admin'
);
$I
->
see
(
'Backend'
,
'h1'
);
$I
->
see
(
'ID'
,
'h3'
);
$I
->
seeLink
(
'guide'
);
$I
->
seeLink
(
'help'
);
$I
->
see
(
'Widget Content'
,
'h4'
);
$I
->
see
(
'Pages'
,
'h4'
);
$I
->
see
(
'Application Settings'
,
'h4'
);
$I
->
see
(
'Auto-detected modules'
,
'h3'
);
$I
->
see
(
'filefly'
,
'a.btn-app'
);
$I
->
see
(
'redirects'
,
'a.btn-app'
);
tests/codeception/functional/VersionCept.php
0 → 100644
View file @
89c9a125
<?php
// @group mandatory
$rootPath
=
realpath
(
__DIR__
.
'/../../..'
);
$I
=
new
FunctionalTester
(
$scenario
);
$I
->
wantTo
(
'check application versioning'
);
$I
->
dontSeeFileFound
(
'version'
,
$rootPath
);
$I
->
seeFileFound
(
'version'
,
$rootPath
.
'/src'
);
$I
->
openFile
(
$rootPath
.
'/src/version'
);
$I
->
dontSeeInThisFile
(
'dev'
);
$I
->
dontSeeInThisFile
(
'dirty'
);
tests/codeception/functional/_bootstrap.php
View file @
89c9a125
<?php
$config
=
require
(
dirname
(
__DIR__
)
.
'/_config/test.php'
);
new
yii\web\Application
(
$config
);
tests/codeception/unit/ControllerTest.php
View file @
89c9a125
<?php
use
yii\codeception\TestCase
;
class
ControllerTest
extends
TestCase
class
ControllerTest
extends
\Codeception\Test\Unit
{
public
$appConfig
=
'@tests/codeception/_config/test.php'
;
/**
* @group mandatory
*/
...
...
@@ -16,7 +11,8 @@ class ControllerTest extends TestCase
$this
->
assertNotNull
(
Yii
::
$app
);
}
public
function
testController
(){
public
function
testController
()
{
$this
->
assertNotFalse
(
Yii
::
$app
->
createController
(
'site/index'
));
}
}
tests/codeception/unit/UserTest.php
0 → 100755
View file @
89c9a125
<?php
namespace
tests\codeception\unit\models
;
use
dektrium\user\models\User
;
class
UserTest
extends
\Codeception\Test\Unit
{
public
function
testUserLoginLogout
()
{
$identity
=
User
::
findIdentity
(
1
);
$this
->
assertTrue
(
\Yii
::
$app
->
user
->
login
(
$identity
,
0
));
$this
->
assertTrue
(
\Yii
::
$app
->
user
->
logout
());
}
public
function
testNonExistingUserModel
()
{
$identity
=
User
::
findIdentity
(
99999
);
$this
->
assertNull
(
$identity
);
}
}
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