Skip to content

Commit

Permalink
fix conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Oct 16, 2017
2 parents ff0b98e + c087365 commit 6ca6854
Show file tree
Hide file tree
Showing 9 changed files with 89 additions and 7 deletions.
4 changes: 4 additions & 0 deletions src/Illuminate/Database/Eloquent/Concerns/HasEvents.php
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,10 @@ public static function flushEventListeners()
foreach ($instance->getObservableEvents() as $event) {
static::$dispatcher->forget("eloquent.{$event}: ".static::class);
}

foreach (array_values($instance->dispatchesEvents) as $event) {
static::$dispatcher->forget($event);
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@

// Fonts
@import url(https://fonts.googleapis.com/css?family=Raleway:300,400,600);
@import url("https://fonts.googleapis.com/css?family=Raleway:300,400,600");

// Variables
@import "variables";

// Bootstrap
@import "node_modules/bootstrap-sass/assets/stylesheets/bootstrap";
@import "~bootstrap-sass/assets/stylesheets/bootstrap";
2 changes: 1 addition & 1 deletion src/Illuminate/Foundation/Console/Presets/vue-stubs/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ window.Vue = require('vue');
* or customize the JavaScript scaffolding to fit your unique needs.
*/

Vue.component('example', require('./components/Example.vue'));
Vue.component('example', require('./components/ExampleComponent.vue'));

const app = new Vue({
el: '#app'
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Foundation/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -902,7 +902,7 @@ function trans_choice($key, $number, array $replace = [], $locale = null)
* @param string $key
* @param array $replace
* @param string $locale
* @return string
* @return string|array|null
*/
function __($key, $replace = [], $locale = null)
{
Expand Down
5 changes: 4 additions & 1 deletion src/Illuminate/Http/JsonResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,16 @@

use JsonSerializable;
use InvalidArgumentException;
use Illuminate\Support\Traits\Macroable;
use Illuminate\Contracts\Support\Jsonable;
use Illuminate\Contracts\Support\Arrayable;
use Symfony\Component\HttpFoundation\JsonResponse as BaseJsonResponse;

class JsonResponse extends BaseJsonResponse
{
use ResponseTrait;
use ResponseTrait, Macroable {
Macroable::__call as macroCall;
}

/**
* Constructor.
Expand Down
5 changes: 4 additions & 1 deletion src/Illuminate/Http/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,17 @@

use ArrayObject;
use JsonSerializable;
use Illuminate\Support\Traits\Macroable;
use Illuminate\Contracts\Support\Jsonable;
use Illuminate\Contracts\Support\Arrayable;
use Illuminate\Contracts\Support\Renderable;
use Symfony\Component\HttpFoundation\Response as BaseResponse;

class Response extends BaseResponse
{
use ResponseTrait;
use ResponseTrait, Macroable {
Macroable::__call as macroCall;
}

/**
* Set the content on the response.
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Translation/Translator.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ public function get($key, array $replace = [], $locale = null, $fallback = true)
* @param string $key
* @param array $replace
* @param string $locale
* @return string
* @return string|array|null
*/
public function getFromJson($key, array $replace = [], $locale = null)
{
Expand Down
72 changes: 72 additions & 0 deletions tests/Integration/Database/EloquentModelCustomEventsTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
<?php

namespace Illuminate\Tests\Integration\Database\EloquentModelCustomEventsTest;

use Orchestra\Testbench\TestCase;
use Illuminate\Support\Facades\Event;
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Eloquent\Model;

/**
* @group integration
*/
class EloquentModelCustomEventsTest extends TestCase
{
protected function getEnvironmentSetUp($app)
{
$app['config']->set('app.debug', 'true');

$app['config']->set('database.default', 'testbench');

$app['config']->set('database.connections.testbench', [
'driver' => 'sqlite',
'database' => ':memory:',
'prefix' => '',
]);
}

public function setUp()
{
parent::setUp();

Schema::create('test_model1', function ($table) {
$table->increments('id');
});

Event::listen(CustomEvent::class, function () {
$_SERVER['fired_event'] = true;
});
}

public function testFlushListenersClearsCustomEvents()
{
$_SERVER['fired_event'] = false;

TestModel1::flushEventListeners();

$user = TestModel1::create();

$this->assertFalse($_SERVER['fired_event']);
}

public function testCustomEventListenersAreFired()
{
$_SERVER['fired_event'] = false;

$user = TestModel1::create();

$this->assertTrue($_SERVER['fired_event']);
}
}

class TestModel1 extends Model
{
public $dispatchesEvents = ['created' => CustomEvent::class];
public $table = 'test_model1';
public $timestamps = false;
protected $guarded = ['id'];
}

class CustomEvent
{
}

0 comments on commit 6ca6854

Please sign in to comment.