Commit db983724 authored by Jens Segers's avatar Jens Segers

Fix some test issues

parent 60c5329a
......@@ -20,8 +20,8 @@
"require-dev": {
"phpunit/phpunit": "^6.0",
"orchestra/testbench": "^3.1",
"mockery/mockery": "^0.9",
"satooshi/php-coveralls": "^1.0",
"mockery/mockery": "^1.0",
"satooshi/php-coveralls": "^2.0",
"doctrine/dbal": "^2.5"
},
"autoload": {
......
......@@ -9,7 +9,7 @@ services:
volumes:
- .:/code
working_dir: /code
command: php ./vendor/bin/phpunit
command: docker/entrypoint.sh
depends_on:
- mysql
- mongodb
......
#!/usr/bin/env bash
sleep 3 && php ./vendor/bin/phpunit
......@@ -198,7 +198,7 @@ class Builder extends BaseBuilder
*/
public function find($id, $columns = [])
{
return $this->where($this->getKeyName(), '=', $this->convertKey($id))->first($columns);
return $this->where('_id', '=', $this->convertKey($id))->first($columns);
}
/**
......
......@@ -21,7 +21,7 @@ class EmbeddedRelationsTest extends TestCase
$address = new Address(['city' => 'London']);
$address->setEventDispatcher($events = Mockery::mock('Illuminate\Events\Dispatcher'));
$events->shouldReceive('fire')->with('eloquent.retrieved: ' . get_class($address), anything());
$events->shouldReceive('fire')->with('eloquent.retrieved: ' . get_class($address), Mockery::any());
$events->shouldReceive('until')->once()->with('eloquent.saving: ' . get_class($address), $address)->andReturn(true);
$events->shouldReceive('until')->once()->with('eloquent.creating: ' . get_class($address), $address)->andReturn(true);
$events->shouldReceive('fire')->once()->with('eloquent.created: ' . get_class($address), $address);
......@@ -47,7 +47,7 @@ class EmbeddedRelationsTest extends TestCase
$this->assertEquals(['London', 'Paris'], $user->addresses->pluck('city')->all());
$address->setEventDispatcher($events = Mockery::mock('Illuminate\Events\Dispatcher'));
$events->shouldReceive('fire')->with('eloquent.retrieved: ' . get_class($address), anything());
$events->shouldReceive('fire')->with('eloquent.retrieved: ' . get_class($address), Mockery::any());
$events->shouldReceive('until')->once()->with('eloquent.saving: ' . get_class($address), $address)->andReturn(true);
$events->shouldReceive('until')->once()->with('eloquent.updating: ' . get_class($address), $address)->andReturn(true);
$events->shouldReceive('fire')->once()->with('eloquent.updated: ' . get_class($address), $address);
......@@ -213,7 +213,7 @@ class EmbeddedRelationsTest extends TestCase
$address = $user->addresses->first();
$address->setEventDispatcher($events = Mockery::mock('Illuminate\Events\Dispatcher'));
$events->shouldReceive('fire')->with('eloquent.retrieved: ' . get_class($address), anything());
$events->shouldReceive('fire')->with('eloquent.retrieved: ' . get_class($address), Mockery::any());
$events->shouldReceive('until')->once()->with('eloquent.deleting: ' . get_class($address), Mockery::type('Address'))->andReturn(true);
$events->shouldReceive('fire')->once()->with('eloquent.deleted: ' . get_class($address), Mockery::type('Address'));
......@@ -252,7 +252,7 @@ class EmbeddedRelationsTest extends TestCase
$address = $user->addresses->first();
$address->setEventDispatcher($events = Mockery::mock('Illuminate\Events\Dispatcher'));
$events->shouldReceive('fire')->with('eloquent.retrieved: ' . get_class($address), anything());
$events->shouldReceive('fire')->with('eloquent.retrieved: ' . get_class($address), Mockery::any());
$events->shouldReceive('until')->once()->with('eloquent.deleting: ' . get_class($address), Mockery::type('Address'))->andReturn(true);
$events->shouldReceive('fire')->once()->with('eloquent.deleted: ' . get_class($address), Mockery::type('Address'));
......@@ -301,7 +301,7 @@ class EmbeddedRelationsTest extends TestCase
$address = new Address(['city' => 'London']);
$address->setEventDispatcher($events = Mockery::mock('Illuminate\Events\Dispatcher'));
$events->shouldReceive('fire')->with('eloquent.retrieved: ' . get_class($address), anything());
$events->shouldReceive('fire')->with('eloquent.retrieved: ' . get_class($address), Mockery::any());
$events->shouldReceive('until')->once()->with('eloquent.saving: ' . get_class($address), $address)->andReturn(true);
$events->shouldReceive('until')->once()->with('eloquent.creating: ' . get_class($address), $address)->andReturn(false);
......@@ -316,7 +316,7 @@ class EmbeddedRelationsTest extends TestCase
$address->exists = true;
$address->setEventDispatcher($events = Mockery::mock('Illuminate\Events\Dispatcher'));
$events->shouldReceive('fire')->with('eloquent.retrieved: ' . get_class($address), anything());
$events->shouldReceive('fire')->with('eloquent.retrieved: ' . get_class($address), Mockery::any());
$events->shouldReceive('until')->once()->with('eloquent.saving: ' . get_class($address), $address)->andReturn(false);
$this->assertFalse($user->addresses()->save($address));
......@@ -330,7 +330,7 @@ class EmbeddedRelationsTest extends TestCase
$user->addresses()->save($address);
$address->setEventDispatcher($events = Mockery::mock('Illuminate\Events\Dispatcher'));
$events->shouldReceive('fire')->with('eloquent.retrieved: ' . get_class($address), anything());
$events->shouldReceive('fire')->with('eloquent.retrieved: ' . get_class($address), Mockery::any());
$events->shouldReceive('until')->once()->with('eloquent.saving: ' . get_class($address), $address)->andReturn(true);
$events->shouldReceive('until')->once()->with('eloquent.updating: ' . get_class($address), $address)->andReturn(false);
......@@ -348,7 +348,7 @@ class EmbeddedRelationsTest extends TestCase
$address = $user->addresses->first();
$address->setEventDispatcher($events = Mockery::mock('Illuminate\Events\Dispatcher'));
$events->shouldReceive('fire')->with('eloquent.retrieved: ' . get_class($address), anything());
$events->shouldReceive('fire')->with('eloquent.retrieved: ' . get_class($address), Mockery::any());
$events->shouldReceive('until')->once()->with('eloquent.deleting: ' . get_class($address), Mockery::mustBe($address))->andReturn(false);
$this->assertEquals(0, $user->addresses()->destroy($address));
......@@ -452,7 +452,7 @@ class EmbeddedRelationsTest extends TestCase
$father = new User(['name' => 'Mark Doe']);
$father->setEventDispatcher($events = Mockery::mock('Illuminate\Events\Dispatcher'));
$events->shouldReceive('fire')->with('eloquent.retrieved: ' . get_class($father), anything());
$events->shouldReceive('fire')->with('eloquent.retrieved: ' . get_class($father), Mockery::any());
$events->shouldReceive('until')->once()->with('eloquent.saving: ' . get_class($father), $father)->andReturn(true);
$events->shouldReceive('until')->once()->with('eloquent.creating: ' . get_class($father), $father)->andReturn(true);
$events->shouldReceive('fire')->once()->with('eloquent.created: ' . get_class($father), $father);
......@@ -472,7 +472,7 @@ class EmbeddedRelationsTest extends TestCase
$this->assertInstanceOf('MongoDB\BSON\ObjectID', $raw['_id']);
$father->setEventDispatcher($events = Mockery::mock('Illuminate\Events\Dispatcher'));
$events->shouldReceive('fire')->with('eloquent.retrieved: ' . get_class($father), anything());
$events->shouldReceive('fire')->with('eloquent.retrieved: ' . get_class($father), Mockery::any());
$events->shouldReceive('until')->once()->with('eloquent.saving: ' . get_class($father), $father)->andReturn(true);
$events->shouldReceive('until')->once()->with('eloquent.updating: ' . get_class($father), $father)->andReturn(true);
$events->shouldReceive('fire')->once()->with('eloquent.updated: ' . get_class($father), $father);
......@@ -488,7 +488,7 @@ class EmbeddedRelationsTest extends TestCase
$father = new User(['name' => 'Jim Doe']);
$father->setEventDispatcher($events = Mockery::mock('Illuminate\Events\Dispatcher'));
$events->shouldReceive('fire')->with('eloquent.retrieved: ' . get_class($father), anything());
$events->shouldReceive('fire')->with('eloquent.retrieved: ' . get_class($father), Mockery::any());
$events->shouldReceive('until')->once()->with('eloquent.saving: ' . get_class($father), $father)->andReturn(true);
$events->shouldReceive('until')->once()->with('eloquent.creating: ' . get_class($father), $father)->andReturn(true);
$events->shouldReceive('fire')->once()->with('eloquent.created: ' . get_class($father), $father);
......@@ -507,7 +507,7 @@ class EmbeddedRelationsTest extends TestCase
$father = new User(['name' => 'Mark Doe']);
$father->setEventDispatcher($events = Mockery::mock('Illuminate\Events\Dispatcher'));
$events->shouldReceive('fire')->with('eloquent.retrieved: ' . get_class($father), anything());
$events->shouldReceive('fire')->with('eloquent.retrieved: ' . get_class($father), Mockery::any());
$events->shouldReceive('until')->times(0)->with('eloquent.saving: ' . get_class($father), $father);
$father = $user->father()->associate($father);
......
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