44
55use BaseTestCase ;
66use Grimzy \LaravelMysqlSpatial \Schema \Blueprint ;
7+ use Illuminate \Database \Schema \ColumnDefinition ;
78use Mockery ;
89
910class BlueprintTest extends BaseTestCase
@@ -20,81 +21,153 @@ public function setUp()
2021
2122 public function testGeometry ()
2223 {
24+ $ expectedCol = new ColumnDefinition ([
25+ 'type ' => 'geometry ' ,
26+ 'name ' => 'col ' ,
27+ 'srid ' => null ,
28+ ]);
29+
2330 $ this ->blueprint
2431 ->shouldReceive ('addColumn ' )
2532 ->with ('geometry ' , 'col ' )
26- ->once ();
33+ ->once ()
34+ ->andReturn ($ expectedCol );
35+
36+ $ result = $ this ->blueprint ->geometry ('col ' );
2737
28- $ this ->blueprint -> geometry ( ' col ' );
38+ $ this ->assertSame ( $ expectedCol , $ result );
2939 }
3040
3141 public function testPoint ()
3242 {
43+ $ expectedCol = new ColumnDefinition ([
44+ 'type ' => 'point ' ,
45+ 'name ' => 'col ' ,
46+ 'srid ' => null ,
47+ ]);
48+
3349 $ this ->blueprint
3450 ->shouldReceive ('addColumn ' )
3551 ->with ('point ' , 'col ' , ['srid ' => null ])
36- ->once ();
52+ ->once ()
53+ ->andReturn ($ expectedCol );
54+
55+ $ result = $ this ->blueprint ->point ('col ' );
3756
38- $ this ->blueprint -> point ( ' col ' );
57+ $ this ->assertSame ( $ expectedCol , $ result );
3958 }
4059
4160 public function testLinestring ()
4261 {
62+ $ expectedCol = new ColumnDefinition ([
63+ 'type ' => 'linestring ' ,
64+ 'name ' => 'col ' ,
65+ 'srid ' => null ,
66+ ]);
67+
4368 $ this ->blueprint
4469 ->shouldReceive ('addColumn ' )
4570 ->with ('linestring ' , 'col ' )
46- ->once ();
71+ ->once ()
72+ ->andReturn ($ expectedCol );
73+
74+ $ result = $ this ->blueprint ->linestring ('col ' );
4775
48- $ this ->blueprint -> linestring ( ' col ' );
76+ $ this ->assertSame ( $ expectedCol , $ result );
4977 }
5078
5179 public function testPolygon ()
5280 {
81+ $ expectedCol = new ColumnDefinition ([
82+ 'type ' => 'polygon ' ,
83+ 'name ' => 'col ' ,
84+ 'srid ' => null ,
85+ ]);
86+
5387 $ this ->blueprint
5488 ->shouldReceive ('addColumn ' )
5589 ->with ('polygon ' , 'col ' )
56- ->once ();
90+ ->once ()
91+ ->andReturn ($ expectedCol );
92+
93+ $ result = $ this ->blueprint ->polygon ('col ' );
5794
58- $ this ->blueprint -> polygon ( ' col ' );
95+ $ this ->assertSame ( $ expectedCol , $ result );
5996 }
6097
6198 public function testMultiPoint ()
6299 {
100+ $ expectedCol = new ColumnDefinition ([
101+ 'type ' => 'multipoint ' ,
102+ 'name ' => 'col ' ,
103+ 'srid ' => null ,
104+ ]);
105+
63106 $ this ->blueprint
64107 ->shouldReceive ('addColumn ' )
65108 ->with ('multipoint ' , 'col ' )
66- ->once ();
109+ ->once ()
110+ ->andReturn ($ expectedCol );
111+
112+ $ result = $ this ->blueprint ->multipoint ('col ' );
67113
68- $ this ->blueprint -> multipoint ( ' col ' );
114+ $ this ->assertSame ( $ expectedCol , $ result );
69115 }
70116
71117 public function testMultiLineString ()
72118 {
119+ $ expectedCol = new ColumnDefinition ([
120+ 'type ' => 'multilinestring ' ,
121+ 'name ' => 'col ' ,
122+ 'srid ' => null ,
123+ ]);
124+
73125 $ this ->blueprint
74126 ->shouldReceive ('addColumn ' )
75127 ->with ('multilinestring ' , 'col ' )
76- ->once ();
128+ ->once ()
129+ ->andReturn ($ expectedCol );
130+
131+ $ result = $ this ->blueprint ->multilinestring ('col ' );
77132
78- $ this ->blueprint -> multilinestring ( ' col ' );
133+ $ this ->assertSame ( $ expectedCol , $ result );
79134 }
80135
81- public function testMulltiPolygon ()
136+ public function testMultiPolygon ()
82137 {
138+ $ expectedCol = new ColumnDefinition ([
139+ 'type ' => 'multipolygon ' ,
140+ 'name ' => 'col ' ,
141+ 'srid ' => null ,
142+ ]);
143+
83144 $ this ->blueprint
84145 ->shouldReceive ('addColumn ' )
85146 ->with ('multipolygon ' , 'col ' )
86- ->once ();
147+ ->once ()
148+ ->andReturn ($ expectedCol );
149+
150+ $ result = $ this ->blueprint ->multipolygon ('col ' );
87151
88- $ this ->blueprint -> multipolygon ( ' col ' );
152+ $ this ->assertSame ( $ expectedCol , $ result );
89153 }
90154
91155 public function testGeometryCollection ()
92156 {
157+ $ expectedCol = new ColumnDefinition ([
158+ 'type ' => 'geometrycollection ' ,
159+ 'name ' => 'col ' ,
160+ 'srid ' => null ,
161+ ]);
162+
93163 $ this ->blueprint
94164 ->shouldReceive ('addColumn ' )
95165 ->with ('geometrycollection ' , 'col ' )
96- ->once ();
166+ ->once ()
167+ ->andReturn ($ expectedCol );
168+
169+ $ result = $ this ->blueprint ->geometrycollection ('col ' );
97170
98- $ this ->blueprint -> geometrycollection ( ' col ' );
171+ $ this ->assertSame ( $ expectedCol , $ result );
99172 }
100173}
0 commit comments