Skip to content

Commit 60779f6

Browse files
committed
Change lot of tests 3 - Fix failing tests
1 parent b80fcd6 commit 60779f6

File tree

46 files changed

+497
-479
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+497
-479
lines changed

tests/migrations/m100000_000000_maria.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
use yii\db\Schema;
44

55
/**
6-
* Initial migration for blog_v2 (based on blog.yaml), so result for blog_v2 should be as secondary mogration
6+
* Initial migration for blog_v2 (based on blog.yaml), so result for blog_v2 should be as secondary migration
77
**/
88
class m100000_000000_maria extends Migration
99
{

tests/specs/blog/migrations_mysql_db/m200000_000001_create_table_users.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ public function up()
1212
'username' => $this->string(200)->notNull(),
1313
'email' => $this->string(200)->notNull(),
1414
'password' => $this->string()->notNull(),
15-
'role' => $this->string(20)->null()->defaultValue('reader'),
16-
'flags' => $this->integer()->null()->defaultValue(0),
17-
'created_at' => $this->timestamp()->null()->defaultExpression("(CURRENT_TIMESTAMP)"),
15+
'role' => $this->string(20)->notNull()->defaultValue('reader'),
16+
'flags' => $this->integer()->notNull()->defaultValue(0),
17+
'created_at' => $this->timestamp()->notNull()->defaultExpression("(CURRENT_TIMESTAMP)"),
1818
]);
1919
$this->createIndex('users_username_key', '{{%users}}', 'username', true);
2020
$this->createIndex('users_email_key', '{{%users}}', 'email', true);

tests/specs/blog/migrations_mysql_db/m200000_000002_create_table_blog_posts.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ public function up()
1010
$this->createTable('{{%blog_posts}}', [
1111
0 => 'uid varchar(128) NOT NULL',
1212
'title' => $this->string(255)->notNull(),
13-
'slug' => $this->string(200)->null()->defaultValue(null),
13+
'slug' => $this->string(200)->notNull(),
1414
'category_id' => $this->integer()->notNull()->comment('Category of posts'),
1515
'active' => $this->boolean()->notNull()->defaultValue(false),
16-
'created_at' => $this->date()->null()->defaultValue(null),
17-
'created_by_id' => $this->integer()->null()->defaultValue(null)->comment('The User'),
16+
'created_at' => $this->date()->notNull(),
17+
'created_by_id' => $this->integer()->notNull()->comment('The User'),
1818
]);
1919
$this->addPrimaryKey('pk_blog_posts_uid', '{{%blog_posts}}', 'uid');
2020
$this->createIndex('blog_posts_title_key', '{{%blog_posts}}', 'title', true);

tests/specs/blog/migrations_mysql_db/m200000_000003_create_table_fakerable.php

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,20 @@ public function up()
99
{
1010
$this->createTable('{{%fakerable}}', [
1111
'id' => $this->bigPrimaryKey(),
12-
'active' => $this->boolean()->null()->defaultValue(null),
13-
'floatval' => $this->float()->null()->defaultValue(null),
14-
'floatval_lim' => $this->float()->null()->defaultValue(null),
15-
'doubleval' => $this->double()->null()->defaultValue(null),
16-
'int_min' => $this->integer()->null()->defaultValue(3),
17-
'int_max' => $this->integer()->null()->defaultValue(null),
18-
'int_minmax' => $this->integer()->null()->defaultValue(null),
19-
'int_created_at' => $this->integer()->null()->defaultValue(null),
20-
'int_simple' => $this->integer()->null()->defaultValue(null),
21-
'str_text' => $this->text()->null(),
22-
'str_varchar' => $this->string(100)->null()->defaultValue(null),
23-
'str_date' => $this->date()->null()->defaultValue(null),
24-
'str_datetime' => $this->timestamp()->null()->defaultValue(null),
25-
'str_country' => $this->text()->null(),
12+
'active' => $this->boolean()->notNull(),
13+
'floatval' => $this->float()->notNull(),
14+
'floatval_lim' => $this->float()->notNull(),
15+
'doubleval' => $this->double()->notNull(),
16+
'int_min' => $this->integer()->notNull()->defaultValue(3),
17+
'int_max' => $this->integer()->notNull(),
18+
'int_minmax' => $this->integer()->notNull(),
19+
'int_created_at' => $this->integer()->notNull(),
20+
'int_simple' => $this->integer()->notNull(),
21+
'str_text' => $this->text()->notNull(),
22+
'str_varchar' => $this->string(100)->notNull(),
23+
'str_date' => $this->date()->notNull(),
24+
'str_datetime' => $this->timestamp()->notNull(),
25+
'str_country' => $this->text()->notNull(),
2626
]);
2727
}
2828

tests/specs/blog/migrations_pgsql_db/m200000_000001_create_table_users.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ public function safeUp()
1212
'username' => $this->string(200)->notNull(),
1313
'email' => $this->string(200)->notNull(),
1414
'password' => $this->string()->notNull(),
15-
'role' => $this->string(20)->null()->defaultValue('reader'),
16-
'flags' => $this->integer()->null()->defaultValue(0),
17-
'created_at' => $this->timestamp()->null()->defaultExpression("(CURRENT_TIMESTAMP)"),
15+
'role' => $this->string(20)->notNull()->defaultValue('reader'),
16+
'flags' => $this->integer()->notNull()->defaultValue(0),
17+
'created_at' => $this->timestamp()->notNull()->defaultExpression("(CURRENT_TIMESTAMP)"),
1818
]);
1919
$this->createIndex('users_username_key', '{{%users}}', 'username', true);
2020
$this->createIndex('users_email_key', '{{%users}}', 'email', true);

tests/specs/blog/migrations_pgsql_db/m200000_000002_create_table_blog_posts.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ public function safeUp()
1010
$this->createTable('{{%blog_posts}}', [
1111
0 => '"uid" varchar(128) NOT NULL',
1212
'title' => $this->string(255)->notNull(),
13-
'slug' => $this->string(200)->null()->defaultValue(null),
13+
'slug' => $this->string(200)->notNull(),
1414
'category_id' => $this->integer()->notNull()->comment('Category of posts'),
1515
'active' => $this->boolean()->notNull()->defaultValue(false),
16-
'created_at' => $this->date()->null()->defaultValue(null),
17-
'created_by_id' => $this->integer()->null()->defaultValue(null)->comment('The User'),
16+
'created_at' => $this->date()->notNull(),
17+
'created_by_id' => $this->integer()->notNull()->comment('The User'),
1818
]);
1919
$this->addPrimaryKey('pk_blog_posts_uid', '{{%blog_posts}}', 'uid');
2020
$this->createIndex('blog_posts_title_key', '{{%blog_posts}}', 'title', true);

tests/specs/blog/migrations_pgsql_db/m200000_000003_create_table_fakerable.php

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,20 @@ public function safeUp()
99
{
1010
$this->createTable('{{%fakerable}}', [
1111
'id' => $this->bigPrimaryKey(),
12-
'active' => $this->boolean()->null()->defaultValue(null),
13-
'floatval' => $this->float()->null()->defaultValue(null),
14-
'floatval_lim' => $this->float()->null()->defaultValue(null),
15-
'doubleval' => $this->double()->null()->defaultValue(null),
16-
'int_min' => $this->integer()->null()->defaultValue(3),
17-
'int_max' => $this->integer()->null()->defaultValue(null),
18-
'int_minmax' => $this->integer()->null()->defaultValue(null),
19-
'int_created_at' => $this->integer()->null()->defaultValue(null),
20-
'int_simple' => $this->integer()->null()->defaultValue(null),
21-
'str_text' => $this->text()->null()->defaultValue(null),
22-
'str_varchar' => $this->string(100)->null()->defaultValue(null),
23-
'str_date' => $this->date()->null()->defaultValue(null),
24-
'str_datetime' => $this->timestamp()->null()->defaultValue(null),
25-
'str_country' => $this->text()->null()->defaultValue(null),
12+
'active' => $this->boolean()->notNull(),
13+
'floatval' => $this->float()->notNull(),
14+
'floatval_lim' => $this->float()->notNull(),
15+
'doubleval' => $this->double()->notNull(),
16+
'int_min' => $this->integer()->notNull()->defaultValue(3),
17+
'int_max' => $this->integer()->notNull(),
18+
'int_minmax' => $this->integer()->notNull(),
19+
'int_created_at' => $this->integer()->notNull(),
20+
'int_simple' => $this->integer()->notNull(),
21+
'str_text' => $this->text()->notNull(),
22+
'str_varchar' => $this->string(100)->notNull(),
23+
'str_date' => $this->date()->notNull(),
24+
'str_datetime' => $this->timestamp()->notNull(),
25+
'str_country' => $this->text()->notNull(),
2626
]);
2727
}
2828

tests/specs/blog_v2.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,12 +268,15 @@ components:
268268
- editor
269269
- reader
270270
x-faker: "$faker->randomElement(['admin', 'editor', 'reader'])"
271+
nullable: true
271272
flags:
272273
type: integer
273274
default: 0
275+
nullable: true
274276
created_at:
275277
type: string
276278
format: date-time
279+
nullable: true
277280
Users:
278281
type: array
279282
items:
@@ -332,19 +335,23 @@ components:
332335
type: string
333336
minLength: 1
334337
maxLength: 200
338+
nullable: true
335339
lang:
336340
type: string
337341
enum:
338342
- ru
339343
- eng
340344
default: ru
345+
nullable: true
341346
category:
342347
$ref: "#/components/schemas/Category"
343348
active:
344349
type: boolean
345350
created_at:
346351
type: string
347352
format: date
353+
nullable: true
354+
default: null
348355
created_by:
349356
$ref: "#/components/schemas/User"
350357
comments:
@@ -384,6 +391,7 @@ components:
384391
minLength: 1
385392
maxLength: 300
386393
default: ''
394+
nullable: true
387395
created_at:
388396
type: string
389397
format: date-time

tests/specs/blog_v2/migrations_maria_db/m200000_000000_change_table_v2_posts.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public function up()
1313
$this->dropColumn('{{%v2_posts}}', 'uid');
1414
$this->alterColumn('{{%v2_posts}}', 'category_id', $this->bigInteger()->notNull());
1515
$this->alterColumn('{{%v2_posts}}', 'active', $this->tinyInteger(1)->notNull());
16-
$this->alterColumn('{{%v2_posts}}', 'created_by_id', $this->bigInteger()->null()->defaultValue(null));
16+
$this->alterColumn('{{%v2_posts}}', 'created_by_id', $this->bigInteger()->notNull());
1717
}
1818

1919
public function down()

tests/specs/blog_v2/migrations_maria_db/m200000_000005_change_table_v2_comments.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public function up()
99
{
1010
$this->dropForeignKey('fk_v2_comments_post_id_v2_posts_uid', '{{%v2_comments}}');
1111
$this->dropForeignKey('fk_v2_comments_author_id_v2_users_id', '{{%v2_comments}}');
12-
$this->addColumn('{{%v2_comments}}', 'user_id', $this->bigInteger()->null()->defaultValue(null)->after('post_id')->comment('The User'));
12+
$this->addColumn('{{%v2_comments}}', 'user_id', $this->bigInteger()->notNull()->after('post_id')->comment('The User'));
1313
$this->dropColumn('{{%v2_comments}}', 'author_id');
1414
$this->alterColumn('{{%v2_comments}}', 'message', $this->text()->notNull());
1515
$this->alterColumn('{{%v2_comments}}', 'meta_data', $this->string(300)->null()->defaultValue(''));

0 commit comments

Comments
 (0)