fix tests configuration

This commit is contained in:
Antonio Ramirez
2016-12-11 12:46:43 +01:00
parent 582c2fb715
commit 0b71a3e9b3
5 changed files with 93 additions and 2 deletions

2
.gitignore vendored
View File

@ -37,3 +37,5 @@ Vagrantfile
# javascript files # javascript files
/node_modules /node_modules
tests/_support/_generated
tests/_output/*

View File

@ -10,6 +10,11 @@ settings:
memory_limit: 1024M memory_limit: 1024M
modules: modules:
config: config:
Db:
dsn: 'mysql:host=localhost;dbname=test'
user: 'root'
password:
dump: tests/_data/schema.sql
Yii2: Yii2:
configFile: 'tests/_app/config/test.php' configFile: 'tests/_app/config/test.php'
coverage: coverage:

View File

@ -12,7 +12,8 @@ class m000000_000001_create_user_table extends \yii\db\Migration
'password_hash' => $this->string(60)->notNull(), 'password_hash' => $this->string(60)->notNull(),
'auth_key' => $this->string(32)->notNull(), 'auth_key' => $this->string(32)->notNull(),
'unconfirmed_email' => $this->string(255), 'unconfirmed_email' => $this->string(255),
'registration_id' => $this->string(45), 'registration_ip' => $this->string(45),
'flags' => $this->integer()->notNull()->defaultValue('0'),
'confirmed_at' => $this->integer(), 'confirmed_at' => $this->integer(),
'blocked_at' => $this->integer(), 'blocked_at' => $this->integer(),
'updated_at' => $this->integer()->notNull(), 'updated_at' => $this->integer()->notNull(),

79
tests/_data/schema.sql Normal file
View File

@ -0,0 +1,79 @@
SET NAMES utf8;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for `profile`
-- ----------------------------
DROP TABLE IF EXISTS `profile`;
CREATE TABLE `profile` (
`user_id` int(11) NOT NULL,
`name` varchar(255) DEFAULT NULL,
`public_email` varchar(255) DEFAULT NULL,
`gravatar_email` varchar(255) DEFAULT NULL,
`gravatar_id` varchar(32) DEFAULT NULL,
`location` varchar(255) DEFAULT NULL,
`website` varchar(255) DEFAULT NULL,
`timezone` varchar(40) DEFAULT NULL,
`bio` text,
PRIMARY KEY (`user_id`),
CONSTRAINT `fk_user_profile` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for `social_account`
-- ----------------------------
DROP TABLE IF EXISTS `social_account`;
CREATE TABLE `social_account` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) DEFAULT NULL,
`provider` varchar(255) NOT NULL,
`client_id` varchar(255) NOT NULL,
`code` varchar(32) DEFAULT NULL,
`email` varchar(255) DEFAULT NULL,
`username` varchar(255) DEFAULT NULL,
`data` text,
`created_at` int(11) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `account_unique` (`provider`,`client_id`),
UNIQUE KEY `account_unique_code` (`code`),
KEY `fk_user_account` (`user_id`),
CONSTRAINT `fk_user_account` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for `token`
-- ----------------------------
DROP TABLE IF EXISTS `token`;
CREATE TABLE `token` (
`user_id` int(11) NOT NULL,
`code` varchar(32) NOT NULL,
`type` smallint(6) NOT NULL,
`created_at` int(11) NOT NULL,
UNIQUE KEY `token_unique` (`user_id`,`code`,`type`),
CONSTRAINT `fk_user_token` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Table structure for `user`
-- ----------------------------
DROP TABLE IF EXISTS `user`;
CREATE TABLE `user` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`username` varchar(255) NOT NULL,
`email` varchar(255) NOT NULL,
`password_hash` varchar(60) NOT NULL,
`auth_key` varchar(32) NOT NULL,
`unconfirmed_email` varchar(255) DEFAULT NULL,
`registration_ip` varchar(45) DEFAULT NULL,
`confirmed_at` int(11) DEFAULT NULL,
`blocked_at` int(11) DEFAULT NULL,
`created_at` int(11) NOT NULL,
`updated_at` int(11) NOT NULL,
`flags` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
UNIQUE KEY `user_unique_email` (`email`),
UNIQUE KEY `user_unique_username` (`username`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8;
SET FOREIGN_KEY_CHECKS = 1;

View File

@ -4,3 +4,7 @@ modules:
- Filesystem - Filesystem
- Yii2 - Yii2
- Asserts - Asserts
- Db:
populate: true
cleanup: true
reconnect: false