forked from dmstr/yii2-db
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added ActiveRecordAccessTrait and unit testing, updated readme / howt…
…o use
- Loading branch information
Chris Stebe
committed
Jun 15, 2016
1 parent
aca8d58
commit 76dc912
Showing
34 changed files
with
4,638 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
before_script: | ||
- export BUILD_PREFIX=buildref${CI_BUILD_REF}$(echo ${CI_BUILD_REF_NAME} | tr -dc '[:alnum:]\n\r' | tr '[:upper:]' '[:lower:]') | ||
- export COMPOSE_PROJECT_NAME=${BUILD_PREFIX}db | ||
- cd tests | ||
|
||
stages: | ||
- test | ||
- report | ||
- cleanup | ||
|
||
test: | ||
stage: test | ||
script: | ||
- set +e | ||
- cd tests | ||
- make up setup | ||
- docker-compose run -e YII_ENV=test --rm phpfpm codecept run --html=_report.html; TESTS_EXIT_CODE=$? | ||
- set -e | ||
- mv _output /tmp/${BUILD_PREFIX} | ||
- exit $TESTS_EXIT_CODE | ||
|
||
report: | ||
stage: report | ||
script: | ||
- mv /tmp/${BUILD_PREFIX} _output | ||
artifacts: | ||
paths: | ||
- tests/_output/ | ||
when: always | ||
|
||
cleanup: | ||
stage: cleanup | ||
script: | ||
- docker-compose kill && docker-compose rm -fv | ||
- docker-compose down --rmi local --volumes | ||
when: always | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
actor: Tester | ||
paths: | ||
tests: tests | ||
log: tests/_output | ||
data: tests/_data | ||
support: tests/_support | ||
envs: tests/_envs | ||
settings: | ||
bootstrap: _bootstrap.php | ||
colors: true | ||
memory_limit: 1024M | ||
extensions: | ||
enabled: | ||
- Codeception\Extension\RunFailed | ||
modules: | ||
config: | ||
Db: | ||
dsn: '' | ||
user: '' | ||
password: '' | ||
dump: tests/_data/dump.sql | ||
config: | ||
test_entry_url: http://web:80/index.php |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
use yii\db\Migration; | ||
|
||
class m160609_090908_add_access_columns extends Migration | ||
{ | ||
// Use safeUp/safeDown to run migration code within a transaction | ||
public function safeUp() | ||
{ | ||
// define all table names you want to equip with access control | ||
$tableNames = ['{%table}', '{%table}']; | ||
|
||
// add the access control columns to the defined tables | ||
foreach ($tableNames as $tableName) { | ||
$this->addColumn($tableName, 'access_owner', 'INT(11) NULL'); | ||
$this->addColumn($tableName, 'access_domain', 'VARCHAR(255) NULL'); | ||
$this->addColumn($tableName, 'access_read', 'VARCHAR(255) NULL'); | ||
$this->addColumn($tableName, 'access_update', 'VARCHAR(255) NULL'); | ||
$this->addColumn($tableName, 'access_delete', 'VARCHAR(255) NULL'); | ||
} | ||
} | ||
|
||
public function safeDown() | ||
{ | ||
echo "m160609_090908_add_access_columns cannot be reverted.\n"; | ||
|
||
return false; | ||
} | ||
} |
Oops, something went wrong.