11<?php
2- namespace Grimzy \LaravelSpatial \Tests \Feature ;
3-
42use Grimzy \LaravelSpatial \SpatialServiceProvider ;
5- use Grimzy \LaravelSpatial \Tests \Feature \Models \GeometryModel ;
63use Grimzy \LaravelSpatial \Types \Point ;
74use Illuminate \Filesystem \Filesystem ;
85use Illuminate \Foundation \Testing \TestCase ;
@@ -21,7 +18,7 @@ public function createApplication()
2118
2219 $ app ->make ('Illuminate\Contracts\Console\Kernel ' )->bootstrap ();
2320
24- $ app ['config ' ]->set ('database.default ' ,'mysql ' );
21+ $ app ['config ' ]->set ('database.default ' , 'mysql ' );
2522 $ app ['config ' ]->set ('database.connections.mysql.host ' , '172.17.0.2 ' );
2623 $ app ['config ' ]->set ('database.connections.mysql.database ' , 'db_test ' );
2724 $ app ['config ' ]->set ('database.connections.mysql.username ' , 'test_user ' );
@@ -53,40 +50,31 @@ public function tearDown()
5350 parent ::tearDown ();
5451 }
5552
56- private function onMigrations (\Closure $ closure ) {
53+ private function onMigrations (\Closure $ closure )
54+ {
5755 $ fileSystem = new Filesystem ();
58- $ classFinder = new ClassFinder ();
56+ $ classFinder = new Tools \ ClassFinder ();
5957
60- foreach ($ fileSystem ->files (__DIR__ . "/Migrations " ) as $ file )
61- {
58+ foreach ($ fileSystem ->files (__DIR__ . "/Migrations " ) as $ file ) {
6259 $ fileSystem ->requireOnce ($ file );
6360 $ migrationClass = $ classFinder ->findClass ($ file );
6461
6562 $ closure ($ migrationClass );
6663 }
6764 }
6865
69- /**
70- * A basic test example.
71- *
72- * @return void
73- */
74- public function testBasicTest ()
75- {
76- $ response = $ this ->get ('/ ' );
77- $ response ->assertStatus (200 );
78- }
79-
80- // TODO: Test with a model missing $spatialFields to expect SpecialFieldNotDefinedException
66+ // TODO: Test with a model missing $spatialFields to expect SpatialFieldNotDefinedException
8167
82- public function testInsert () {
68+ public function testInsert ()
69+ {
8370 $ geo = new GeometryModel ();
8471 $ geo ->location = new Point (1 , 2 );
8572 $ geo ->save ();
8673 $ this ->assertDatabaseHas ('geometry ' , ['id ' => $ geo ->id ]);
8774 }
8875
89- public function testUpdate () {
76+ public function testUpdate ()
77+ {
9078 $ geo = new GeometryModel ();
9179 $ geo ->location = new Point (1 , 2 );
9280 $ geo ->save ();
@@ -99,7 +87,7 @@ public function testUpdate() {
9987
10088 $ all = GeometryModel::all ();
10189 $ this ->assertCount (1 , $ all );
102-
90+
10391 $ updated = $ all ->first ();
10492 $ this ->assertInstanceOf (Point::class, $ updated ->location );
10593 $ this ->assertEquals (2 , $ updated ->location ->getLat ());
0 commit comments