@@ -582,6 +582,25 @@ public function testAddingJson()
582
582
$ this ->assertSame ('alter table "users" add column "foo" text not null ' , $ statements [0 ]);
583
583
}
584
584
585
+ public function testAddingNativeJson ()
586
+ {
587
+ $ connection = m::mock (Connection::class);
588
+ $ connection
589
+ ->shouldReceive ('getTablePrefix ' )->andReturn ('' )
590
+ ->shouldReceive ('getConfig ' )->once ()->with ('use_native_json ' )->andReturn (true )
591
+ ->shouldReceive ('getSchemaGrammar ' )->andReturn ($ this ->getGrammar ($ connection ))
592
+ ->shouldReceive ('getSchemaBuilder ' )->andReturn ($ this ->getBuilder ())
593
+ ->shouldReceive ('getServerVersion ' )->andReturn ('3.35 ' )
594
+ ->getMock ();
595
+
596
+ $ blueprint = new Blueprint ($ connection , 'users ' );
597
+ $ blueprint ->json ('foo ' );
598
+ $ statements = $ blueprint ->toSql ();
599
+
600
+ $ this ->assertCount (1 , $ statements );
601
+ $ this ->assertSame ('alter table "users" add column "foo" json not null ' , $ statements [0 ]);
602
+ }
603
+
585
604
public function testAddingJsonb ()
586
605
{
587
606
$ blueprint = new Blueprint ($ this ->getConnection (), 'users ' );
@@ -592,6 +611,25 @@ public function testAddingJsonb()
592
611
$ this ->assertSame ('alter table "users" add column "foo" text not null ' , $ statements [0 ]);
593
612
}
594
613
614
+ public function testAddingNativeJsonb ()
615
+ {
616
+ $ connection = m::mock (Connection::class);
617
+ $ connection
618
+ ->shouldReceive ('getTablePrefix ' )->andReturn ('' )
619
+ ->shouldReceive ('getConfig ' )->once ()->with ('use_native_jsonb ' )->andReturn (true )
620
+ ->shouldReceive ('getSchemaGrammar ' )->andReturn ($ this ->getGrammar ($ connection ))
621
+ ->shouldReceive ('getSchemaBuilder ' )->andReturn ($ this ->getBuilder ())
622
+ ->shouldReceive ('getServerVersion ' )->andReturn ('3.35 ' )
623
+ ->getMock ();
624
+
625
+ $ blueprint = new Blueprint ($ connection , 'users ' );
626
+ $ blueprint ->jsonb ('foo ' );
627
+ $ statements = $ blueprint ->toSql ();
628
+
629
+ $ this ->assertCount (1 , $ statements );
630
+ $ this ->assertSame ('alter table "users" add column "foo" jsonb not null ' , $ statements [0 ]);
631
+ }
632
+
595
633
public function testAddingDate ()
596
634
{
597
635
$ blueprint = new Blueprint ($ this ->getConnection (), 'users ' );
0 commit comments