Commit bdb15c94 authored by Stas's avatar Stas Committed by Jens Segers

Fix tests (#1724)

*   Update Dockerfile, add for methods setUp and tearDown return type hint in all tests, replace fire on dispatch

* Resolve error test with touch

* Use COMPOSER_VERSION in Dockerfile

* Add alias for composer

* Change parent method's names
Broken commit in laravel: https://github.com/laravel/framework/commit/2ee18923eaff142a89439f0adf0d3f15c30db85b

* Remove changes in .travis.yml

* Remove changes from Dockerfile

* Revert changes in docker-compose.yml

* Update image with mysql
parent 55c1aa15
......@@ -16,7 +16,7 @@ services:
mysql:
container_name: mysql
image: mysql
image: mysql:5.7
environment:
MYSQL_ROOT_PASSWORD:
MYSQL_DATABASE: unittest
......
......@@ -177,6 +177,31 @@ class Builder extends EloquentBuilder
return $results;
}
/**
* Add the "updated at" column to an array of values.
* TODO Remove if https://github.com/laravel/framework/commit/6484744326531829341e1ff886cc9b628b20d73e
* wiil be reverted
* Issue in laravel frawework https://github.com/laravel/framework/issues/27791
*
* @param array $values
* @return array
*/
protected function addUpdatedAtColumn(array $values)
{
if (! $this->model->usesTimestamps() ||
is_null($this->model->getUpdatedAtColumn())) {
return $values;
}
$column = $this->model->getUpdatedAtColumn();
$values = array_merge(
[$column => $this->model->freshTimestampString()],
$values
);
return $values;
}
/**
* @return \Illuminate\Database\ConnectionInterface
*/
......
......@@ -110,7 +110,7 @@ trait QueriesRelationships
}
if ($relation instanceof BelongsTo) {
return $relation->getForeignKey();
return $relation->getForeignKeyName();
}
if ($relation instanceof BelongsToMany && ! $this->isAcrossConnections($relation)) {
......@@ -130,7 +130,7 @@ trait QueriesRelationships
return $relation->getHasCompareKey();
}
return $relation instanceof HasOneOrMany ? $relation->getForeignKeyName() : $relation->getOwnerKey();
return $relation instanceof HasOneOrMany ? $relation->getForeignKeyName() : $relation->getOwnerKeyName();
}
/**
......
......@@ -5,8 +5,9 @@ use Illuminate\Foundation\Application;
class AuthTest extends TestCase
{
public function tearDown()
public function tearDown(): void
{
parent::setUp();
User::truncate();
DB::collection('password_reminders')->truncate();
}
......
This diff is collapsed.
......@@ -2,7 +2,7 @@
class GeospatialTest extends TestCase
{
public function setUp()
public function setUp(): void
{
parent::setUp();
......@@ -43,7 +43,7 @@ class GeospatialTest extends TestCase
]);
}
public function tearDown()
public function tearDown(): void
{
Schema::drop('locations');
}
......
......@@ -2,7 +2,7 @@
class HybridRelationsTest extends TestCase
{
public function setUp()
public function setUp(): void
{
parent::setUp();
......@@ -11,7 +11,7 @@ class HybridRelationsTest extends TestCase
MysqlRole::executeSchema();
}
public function tearDown()
public function tearDown(): void
{
MysqlUser::truncate();
MysqlBook::truncate();
......
......@@ -8,7 +8,7 @@ use MongoDB\BSON\UTCDateTime;
class ModelTest extends TestCase
{
public function tearDown()
public function tearDown(): void
{
User::truncate();
Soft::truncate();
......@@ -262,7 +262,6 @@ class ModelTest extends TestCase
$user->save();
$old = $user->updated_at;
sleep(1);
$user->touch();
$check = User::find($user->_id);
......
......@@ -5,7 +5,7 @@ use MongoDB\BSON\Regex;
class QueryBuilderTest extends TestCase
{
public function tearDown()
public function tearDown(): void
{
DB::collection('users')->truncate();
DB::collection('items')->truncate();
......
......@@ -4,7 +4,7 @@ class QueryTest extends TestCase
{
protected static $started = false;
public function setUp()
public function setUp(): void
{
parent::setUp();
User::create(['name' => 'John Doe', 'age' => 35, 'title' => 'admin']);
......@@ -18,7 +18,7 @@ class QueryTest extends TestCase
User::create(['name' => 'Error', 'age' => null, 'title' => null]);
}
public function tearDown()
public function tearDown(): void
{
User::truncate();
parent::tearDown();
......
......@@ -2,7 +2,7 @@
class QueueTest extends TestCase
{
public function setUp()
public function setUp(): void
{
parent::setUp();
......
......@@ -2,7 +2,7 @@
class RelationsTest extends TestCase
{
public function tearDown()
public function tearDown(): void
{
Mockery::close();
......
......@@ -2,7 +2,7 @@
class SchemaTest extends TestCase
{
public function tearDown()
public function tearDown(): void
{
Schema::drop('newcollection');
}
......
......@@ -2,7 +2,7 @@
class SeederTest extends TestCase
{
public function tearDown()
public function tearDown(): void
{
User::truncate();
}
......
......@@ -2,7 +2,7 @@
class ValidationTest extends TestCase
{
public function tearDown()
public function tearDown(): void
{
User::truncate();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment