Skip to content

Commit

Permalink
fix conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Jan 5, 2017
2 parents 07f96b7 + 27e8d71 commit d98b425
Show file tree
Hide file tree
Showing 6 changed files with 91 additions and 2 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG-5.3.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
- Check for `db` before setting presence verifier in `ValidationServiceProvider` ([038840d](https://github.com/laravel/framework/commit/038840d477e606735f9179d97eeb20639450e8ae))
- Make Eloquent's `getTimeZone()` method call adhere to `DateTimeInterface` ([#16955](https://github.com/laravel/framework/pull/16955))
- Support customizable response in `SendsPasswordResetEmails` ([#16982](https://github.com/laravel/framework/pull/16982))
- Stricter comparison when replacing URL for `LocalAdapter` ([#17097](https://github.com/laravel/framework/pull/17097))
- Use `notification()` relationship in `HasDatabaseNotifications` ([#17093](https://github.com/laravel/framework/pull/17093))
- Allow float value as expiration in Memcached cache store ([#17106](https://github.com/laravel/framework/pull/17106))

### Fixed
- Fixed a wildcard issue with `sometimes` validation rule ([#16826](https://github.com/laravel/framework/pull/16826))
Expand All @@ -33,7 +36,9 @@
- Fixed empty model creation ([#16864](https://github.com/laravel/framework/pull/16864))
- Fixed column overlapping on using `withCount()` on `BelongsToMany` ([#16895](https://github.com/laravel/framework/pull/16895))
- Fixed `Unique::ignore()` issue ([#16948](https://github.com/laravel/framework/pull/16948))

- Fixed logic in `ChannelManager::sendNow()` if `$channels` is `null` ([#17068](https://github.com/laravel/framework/pull/17068))
- Fixed validating distinct for nested keys ([#17102](https://github.com/laravel/framework/pull/17102))
- Fixed `HasManyThrough::updateOrCreate()` ([#17105](https://github.com/laravel/framework/pull/17105))

## v5.3.28 (2016-12-15)

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"nesbot/carbon": "~1.20",
"paragonie/random_compat": "~1.4|~2.0",
"ramsey/uuid": "~3.0",
"swiftmailer/swiftmailer": "~5.1",
"swiftmailer/swiftmailer": "~5.4",
"symfony/console": "~3.2",
"symfony/debug": "~3.2",
"symfony/finder": "~3.2",
Expand Down
10 changes: 10 additions & 0 deletions src/Illuminate/Console/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,16 @@ protected function bootstrap()
}
}

/*
* Clear the console application bootstrappers.
*
* @return void
*/
public static function forgetBootstrappers()
{
static::$bootstrappers = [];
}

/**
* Run an Artisan console command by name.
*
Expand Down
33 changes: 33 additions & 0 deletions src/Illuminate/Database/Eloquent/Relations/HasManyThrough.php
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,39 @@ public function findOrFail($id, $columns = ['*'])
throw (new ModelNotFoundException)->setModel(get_class($this->parent));
}

/**
* Get the first related model record matching the attributes or instantiate it.
*
* @param array $attributes
* @return \Illuminate\Database\Eloquent\Model
*/
public function firstOrNew(array $attributes)
{
if (is_null($instance = $this->where($attributes)->first())) {
$instance = $this->related->newInstance($attributes);
}

return $instance;
}

/**
* Create or update a related record matching the attributes, and fill it with values.
*
* @param array $attributes
* @param array $values
* @param array $joining
* @param bool $touch
* @return \Illuminate\Database\Eloquent\Model
*/
public function updateOrCreate(array $attributes, array $values = [])
{
$instance = $this->firstOrNew($attributes);

$instance->fill($values)->save();

return $instance;
}

/**
* Execute the query as a "select" statement.
*
Expand Down
3 changes: 3 additions & 0 deletions src/Illuminate/Foundation/Testing/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use PHPUnit_Framework_TestCase;
use Illuminate\Support\Facades\Facade;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Console\Application as Artisan;

abstract class TestCase extends PHPUnit_Framework_TestCase
{
Expand Down Expand Up @@ -144,6 +145,8 @@ protected function tearDown()

$this->afterApplicationCreatedCallbacks = [];
$this->beforeApplicationDestroyedCallbacks = [];

Artisan::forgetBootstrappers();
}

/**
Expand Down
38 changes: 38 additions & 0 deletions tests/Bus/BusDispatcherTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
use Illuminate\Bus\Dispatcher;
use PHPUnit\Framework\TestCase;
use Illuminate\Container\Container;
use Illuminate\Config\Repository as Config;

class BusDispatcherTest extends TestCase
{
Expand Down Expand Up @@ -77,6 +78,32 @@ public function testDispatcherCanDispatchStandAloneHandler()

$this->assertInstanceOf(StandAloneCommand::class, $response);
}

public function testOnConnectionOnJobWhenDispatching()
{
$container = new Container;
$container->singleton('config', function () {
return new Config([
'queue' => [
'default' => 'null',
'connections' => [
'null' => ['driver' => 'null'],
],
],
]);
});

$dispatcher = new Dispatcher($container, function () {
$mock = m::mock('Illuminate\Contracts\Queue\Queue');
$mock->shouldReceive('push')->once();

return $mock;
});

$job = (new ShouldNotBeDispatched)->onConnection('null');

$dispatcher->dispatch($job);
}
}

class BusInjectionStub
Expand Down Expand Up @@ -123,3 +150,14 @@ public function handle(StandAloneCommand $command)
return $command;
}
}

class ShouldNotBeDispatched implements Illuminate\Contracts\Queue\ShouldQueue
{
use Illuminate\Bus\Queueable,
Illuminate\Queue\InteractsWithQueue;

public function handle()
{
throw new RuntimeException('This should not be run');
}
}

0 comments on commit d98b425

Please sign in to comment.