Skip to content

Commit 7f947aa

Browse files
committed
Added TravisCI
1 parent ce6fb8c commit 7f947aa

File tree

5 files changed

+47
-35
lines changed

5 files changed

+47
-35
lines changed

.travis.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
language: php
2+
php:
3+
- '5.5'
4+
- '5.6'
5+
- '7.0'
6+
- '7.1'
7+
- hhvm
8+
- nightly
9+
10+
services:
11+
- mysql
12+
13+
before_install:
14+
- mysql -e 'CREATE DATABASE test;'

phpunit.xml.dist

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
<testsuite name="Unit Tests">
1313
<directory suffix="Test.php">./tests/Unit</directory>
1414
</testsuite>
15-
<!--<testsuite name="Feature Tests">-->
16-
<!--<directory suffix="Test.php">./tests/Feature</directory>-->
17-
<!--</testsuite>-->
15+
<testsuite name="Feature Tests">
16+
<directory suffix="Test.php">./tests/Feature</directory>
17+
</testsuite>
1818
</testsuites>
1919
<php>
2020
<env name="APP_ENV" value="testing"/>

start_db.sh

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
docker run -d --name spatial-mysql \
44
-p 3306:3306 \
55
-v $(pwd)/db:/var/lib/mysql \
6-
-e MYSQL_DATABASE=db_test \
7-
-e MYSQL_USER=test_user \
8-
-e MYSQL_PASSWORD=123456 \
9-
-e MYSQL_ROOT_PASSWORD=123456 \
6+
-e MYSQL_DATABASE=test \
7+
-e MYSQL_ALLOW_EMPTY_PASSWORD=yes \
108
mysql:latest

tests/Feature/SpatialTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ public function createApplication()
1919
$app->make('Illuminate\Contracts\Console\Kernel')->bootstrap();
2020

2121
$app['config']->set('database.default', 'mysql');
22-
$app['config']->set('database.connections.mysql.host', '172.17.0.2');
23-
$app['config']->set('database.connections.mysql.database', 'db_test');
24-
$app['config']->set('database.connections.mysql.username', 'test_user');
25-
$app['config']->set('database.connections.mysql.password', '123456');
22+
$app['config']->set('database.connections.mysql.host', env('DOCKER_DB_HOST', '127.0.0.1'));
23+
$app['config']->set('database.connections.mysql.database', 'test');
24+
$app['config']->set('database.connections.mysql.username', 'root');
25+
$app['config']->set('database.connections.mysql.password', '');
2626

2727
return $app;
2828
}

tests/Unit/Eloquent/BuilderTest.php

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -62,30 +62,30 @@ public function testUpdate()
6262
$builder->update(['point' => new Point(1, 3)]);
6363
}
6464

65-
// public function testUpdateLinestring()
66-
// {
67-
// $this->queryBuilder
68-
// ->shouldReceive('raw')
69-
// ->with("ST_GeogFromText('LINESTRING(0 0, 1 1, 2 2)')")
70-
// ->andReturn(new Expression("ST_GeogFromText('LINESTRING(0 0, 1 1, 2 2)')"));
71-
//
72-
// $this->queryBuilder
73-
// ->shouldReceive('update')
74-
// ->andReturn(1);
75-
//
76-
// $linestring = new LineString([new Point(0, 0), new Point(1, 1), new Point(2, 2)]);
77-
//
78-
// $builder = Mockery::mock(Builder::class, [$this->queryBuilder])->makePartial();
79-
// $builder->shouldAllowMockingProtectedMethods();
80-
// $builder
81-
// ->shouldReceive('addUpdatedAtColumn')
82-
// ->andReturn(['linestring' => $linestring]);
83-
//
84-
// $builder
85-
// ->shouldReceive('asWKT')->with($linestring)->once();
86-
//
87-
// $builder->update(['linestring' => $linestring]);
88-
// }
65+
public function testUpdateLinestring()
66+
{
67+
$this->queryBuilder
68+
->shouldReceive('raw')
69+
->with("ST_GeogFromText('LINESTRING(0 0, 1 1, 2 2)')")
70+
->andReturn(new Expression("ST_GeogFromText('LINESTRING(0 0, 1 1, 2 2)')"));
71+
72+
$this->queryBuilder
73+
->shouldReceive('update')
74+
->andReturn(1);
75+
76+
$linestring = new LineString([new Point(0, 0), new Point(1, 1), new Point(2, 2)]);
77+
78+
$builder = Mockery::mock(Builder::class, [$this->queryBuilder])->makePartial();
79+
$builder->shouldAllowMockingProtectedMethods();
80+
$builder
81+
->shouldReceive('addUpdatedAtColumn')
82+
->andReturn(['linestring' => $linestring]);
83+
84+
$builder
85+
->shouldReceive('asWKT')->with($linestring)->once();
86+
87+
$builder->update(['linestring' => $linestring]);
88+
}
8989
}
9090

9191
class TestBuilderModel extends Model

0 commit comments

Comments
 (0)