From 3abe40867215d8506807848981a8c937e177527e Mon Sep 17 00:00:00 2001 From: Tom Witkowski Date: Mon, 6 Feb 2017 11:13:41 +0100 Subject: [PATCH 01/24] first try to use mysql for tests --- .travis.yml | 24 +++++++++++++++++++----- phpunit.xml | 1 - tests/NotifynderTestCase.php | 22 +++++++++++++++++++--- 3 files changed, 38 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3d013f7..2965193 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,6 +13,10 @@ addons: code_climate: repo_token: ${CC_TOKEN} +## Services used by this package +services: + - mysql + ## List all PHP versions to test with php: - 5.5 @@ -24,11 +28,16 @@ php: ## Define all ENV vars to test with env: - - LARAVEL_VERSION="5.0.*" - - LARAVEL_VERSION="5.1.*" - - LARAVEL_VERSION="5.2.*" - - LARAVEL_VERSION="5.3.*" - - LARAVEL_VERSION="5.4.*" + - LARAVEL_VERSION="5.0.*" DB_TYPE="sqlite" + - LARAVEL_VERSION="5.0.*" DB_TYPE="mysql" + - LARAVEL_VERSION="5.1.*" DB_TYPE="sqlite" + - LARAVEL_VERSION="5.1.*" DB_TYPE="mysql" + - LARAVEL_VERSION="5.2.*" DB_TYPE="sqlite" + - LARAVEL_VERSION="5.2.*" DB_TYPE="mysql" + - LARAVEL_VERSION="5.3.*" DB_TYPE="sqlite" + - LARAVEL_VERSION="5.3.*" DB_TYPE="mysql" + - LARAVEL_VERSION="5.4.*" DB_TYPE="sqlite" + - LARAVEL_VERSION="5.4.*" DB_TYPE="mysql" - LARAVEL_VERSION="dev-master" matrix: @@ -47,6 +56,10 @@ matrix: - php: hhvm - env: LARAVEL_VERSION="dev-master" +## Run Scripts before Install +before_install: + - mysql -e 'CREATE DATABASE IF NOT EXISTS notifynder;' + ## Install Dependencies install: - composer self-update @@ -62,6 +75,7 @@ before_script: script: - vendor/bin/phpunit +## Run Scripts after Tests after_script: - vendor/bin/test-reporter - export CI_BUILD_NUMBER="$TRAVIS_BUILD_NUMBER" diff --git a/phpunit.xml b/phpunit.xml index ebefb65..c203337 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -31,7 +31,6 @@ - diff --git a/tests/NotifynderTestCase.php b/tests/NotifynderTestCase.php index 9d3df9b..868de21 100644 --- a/tests/NotifynderTestCase.php +++ b/tests/NotifynderTestCase.php @@ -41,12 +41,29 @@ public function setUp() protected function getEnvironmentSetUp($app) { - $app['config']->set('database.default', 'testbench'); - $app['config']->set('database.connections.testbench', [ + $app['config']->set('database.connections.test_sqlite', [ 'driver' => 'sqlite', 'database' => ':memory:', 'prefix' => '', ]); + $app['config']->set('database.connections.test_mysql', [ + 'driver' => 'mysql', + 'host' => '127.0.0.1', + 'port' => 3306, + 'database' => 'notifynder', + 'username' => 'travis', + 'password' => '', + 'charset' => 'utf8', + 'collation' => 'utf8_general_ci', + 'prefix' => '', + 'strict' => false, + 'engine' => null, + ]); + if(env('DB_TYPE', 'sqlite') == 'mysql') { + $app['config']->set('database.default', 'test_mysql'); + } else { + $app['config']->set('database.default', 'test_sqlite'); + } } public function tearDown() @@ -62,7 +79,6 @@ protected function getApplicationTimezone($app) protected function migrate($artisan, $path = '/../../../../src/migrations') { $artisan->call('migrate', [ - '--database' => 'testbench', '--path' => $path, ]); } From 45bd15eb40742e2892500660f944dad8587bc8ba Mon Sep 17 00:00:00 2001 From: Tom Witkowski Date: Mon, 6 Feb 2017 10:13:53 +0000 Subject: [PATCH 02/24] Apply fixes from StyleCI [ci skip] [skip ci] --- tests/NotifynderTestCase.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/NotifynderTestCase.php b/tests/NotifynderTestCase.php index 868de21..10cf24c 100644 --- a/tests/NotifynderTestCase.php +++ b/tests/NotifynderTestCase.php @@ -59,7 +59,7 @@ protected function getEnvironmentSetUp($app) 'strict' => false, 'engine' => null, ]); - if(env('DB_TYPE', 'sqlite') == 'mysql') { + if (env('DB_TYPE', 'sqlite') == 'mysql') { $app['config']->set('database.default', 'test_mysql'); } else { $app['config']->set('database.default', 'test_sqlite'); From ff67195f784e32cbab1004757aea6222ca623ecb Mon Sep 17 00:00:00 2001 From: Tom Witkowski Date: Mon, 6 Feb 2017 11:17:13 +0100 Subject: [PATCH 03/24] remove comment --- tests/NotifynderTestCase.php | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/NotifynderTestCase.php b/tests/NotifynderTestCase.php index 868de21..d321e06 100644 --- a/tests/NotifynderTestCase.php +++ b/tests/NotifynderTestCase.php @@ -29,7 +29,6 @@ protected function getPackageAliases($app) public function setUp() { parent::setUp(); - // This should only do work for Sqlite DBs in memory. $artisan = $this->app->make('Illuminate\Contracts\Console\Kernel'); app('db')->beginTransaction(); $this->migrate($artisan); From 8f0979484ca4471381f433c5683f131326ccdd77 Mon Sep 17 00:00:00 2001 From: Tom Witkowski Date: Mon, 6 Feb 2017 11:17:47 +0100 Subject: [PATCH 04/24] change order to remove tables SQLSTATE[23000]: Integrity constraint violation: 1217 Cannot delete or update a parent row: a foreign key constraint fails (SQL: drop table if exists `notification_groups`) --- .../2016_11_02_193415_drop_version4_unused_tables.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/migrations/2016_11_02_193415_drop_version4_unused_tables.php b/src/migrations/2016_11_02_193415_drop_version4_unused_tables.php index b0af3a7..ad8c72f 100644 --- a/src/migrations/2016_11_02_193415_drop_version4_unused_tables.php +++ b/src/migrations/2016_11_02_193415_drop_version4_unused_tables.php @@ -11,8 +11,8 @@ class DropVersion4UnusedTables extends Migration */ public function up() { - Schema::dropIfExists('notification_groups'); Schema::dropIfExists('notifications_categories_in_groups'); + Schema::dropIfExists('notification_groups'); } /** From 157cbf1c528ef4a28f74b7dbc109117a3b39de0d Mon Sep 17 00:00:00 2001 From: Tom Witkowski Date: Mon, 6 Feb 2017 11:29:55 +0100 Subject: [PATCH 05/24] fix mysql test errors (category id constraints) --- tests/NotifynderTestCase.php | 3 ++- .../Facades/NotifynderFacadeTest.php | 3 ++- .../Managers/NotifynderManagerTest.php | 24 ++++++++++++------- tests/integration/Traits/NotifableTest.php | 3 ++- 4 files changed, 21 insertions(+), 12 deletions(-) diff --git a/tests/NotifynderTestCase.php b/tests/NotifynderTestCase.php index 801f56e..ade8ae5 100644 --- a/tests/NotifynderTestCase.php +++ b/tests/NotifynderTestCase.php @@ -122,8 +122,9 @@ protected function createCar(array $attributes = []) protected function sendNotificationTo(Model $model) { + $category = $this->createCategory(); return $model - ->sendNotificationTo(1) + ->sendNotificationTo($category->getKey()) ->from(2) ->send(); } diff --git a/tests/integration/Facades/NotifynderFacadeTest.php b/tests/integration/Facades/NotifynderFacadeTest.php index dc53262..8a5fbfe 100644 --- a/tests/integration/Facades/NotifynderFacadeTest.php +++ b/tests/integration/Facades/NotifynderFacadeTest.php @@ -7,7 +7,8 @@ class NotifynderFacadeTest extends NotifynderTestCase { public function testSendSingleNotification() { - $sent = \Notifynder::category(1) + $category = $this->createCategory(); + $sent = \Notifynder::category($category->getKey()) ->from(1) ->to(2) ->send(); diff --git a/tests/integration/Managers/NotifynderManagerTest.php b/tests/integration/Managers/NotifynderManagerTest.php index c6c3010..29c9888 100644 --- a/tests/integration/Managers/NotifynderManagerTest.php +++ b/tests/integration/Managers/NotifynderManagerTest.php @@ -61,7 +61,8 @@ public function testBuildMultipleNotifications() public function testSendSingleNotification() { $manager = app('notifynder'); - $sent = $manager->category(1) + $category = $this->createCategory(); + $sent = $manager->category($category->getKey()) ->from(1) ->to(2) ->send(); @@ -76,7 +77,8 @@ public function testSendSingleNotification() public function testSendSingleAnonymousNotification() { $manager = app('notifynder'); - $sent = $manager->category(1) + $category = $this->createCategory(); + $sent = $manager->category($category->getKey()) ->anonymous() ->to(2) ->send(); @@ -98,8 +100,9 @@ public function testSendMultipleNotifications() { $datas = [2, 3, 4]; $manager = app('notifynder'); - $sent = $manager->loop($datas, function ($builder, $data) { - $builder->category(1) + $category = $this->createCategory(); + $sent = $manager->loop($datas, function ($builder, $data) use ($category) { + $builder->category($category->getKey()) ->from(1) ->to($data); })->send(); @@ -114,7 +117,8 @@ public function testSendMultipleNotifications() public function testSendSingleSpecificNotification() { $manager = app('notifynder'); - $sent = $manager->category(1) + $category = $this->createCategory(); + $sent = $manager->category($category->getKey()) ->from(1) ->to(2) ->sendSingle(); @@ -129,7 +133,8 @@ public function testSendSingleSpecificNotification() public function testSendOnceSameNotifications() { $manager = app('notifynder'); - $sent = $manager->category(1) + $category = $this->createCategory(); + $sent = $manager->category($category->getKey()) ->from(1) ->to(2) ->extra(['foo' => 'bar']) @@ -148,7 +153,7 @@ public function testSendOnceSameNotifications() sleep(1); - $sent = $manager->category(1) + $sent = $manager->category($category->getKey()) ->from(1) ->to(2) ->extra(['foo' => 'bar']) @@ -172,7 +177,8 @@ public function testSendOnceSameNotifications() public function testSendOnceDifferentNotifications() { $manager = app('notifynder'); - $sent = $manager->category(1) + $category = $this->createCategory(); + $sent = $manager->category($category->getKey()) ->from(1) ->to(2) ->extra(['foo' => 'bar']) @@ -183,7 +189,7 @@ public function testSendOnceDifferentNotifications() $this->assertCount(1, $notifications); $this->assertInstanceOf(EloquentCollection::class, $notifications); - $sent = $manager->category(1) + $sent = $manager->category($category->getKey()) ->from(2) ->to(1) ->extra(['hello' => 'world']) diff --git a/tests/integration/Traits/NotifableTest.php b/tests/integration/Traits/NotifableTest.php index c17bbdf..cbe91ca 100644 --- a/tests/integration/Traits/NotifableTest.php +++ b/tests/integration/Traits/NotifableTest.php @@ -51,9 +51,10 @@ public function testSendNotificationTo() public function testNotificationsHasMany() { + $category = $this->createCategory(); $user = $this->createUser(); $user - ->sendNotificationTo(1) + ->sendNotificationTo($category->getKey()) ->from(2) ->send(); $this->assertCount(1, $user->getNotificationRelation); From 9f177c753daf01c406e8f12402aa93a37642f0bd Mon Sep 17 00:00:00 2001 From: Tom Witkowski Date: Mon, 6 Feb 2017 10:30:07 +0000 Subject: [PATCH 06/24] Apply fixes from StyleCI [ci skip] [skip ci] --- tests/NotifynderTestCase.php | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/NotifynderTestCase.php b/tests/NotifynderTestCase.php index ade8ae5..d2e78e5 100644 --- a/tests/NotifynderTestCase.php +++ b/tests/NotifynderTestCase.php @@ -123,6 +123,7 @@ protected function createCar(array $attributes = []) protected function sendNotificationTo(Model $model) { $category = $this->createCategory(); + return $model ->sendNotificationTo($category->getKey()) ->from(2) From 9ae3018b4c937542356dca3e15ddeb5632bade15 Mon Sep 17 00:00:00 2001 From: Tom Witkowski Date: Mon, 6 Feb 2017 11:34:47 +0100 Subject: [PATCH 07/24] fix mysql test errors (category name constraints) --- tests/NotifynderTestCase.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/NotifynderTestCase.php b/tests/NotifynderTestCase.php index ade8ae5..72fda31 100644 --- a/tests/NotifynderTestCase.php +++ b/tests/NotifynderTestCase.php @@ -89,6 +89,11 @@ protected function createCategory(array $attributes = []) 'name' => 'test.category', ], $attributes); + $category = NotificationCategory::byName($attributes['name'])->first(); + if($category instanceof NotificationCategory) { + return $category; + } + return NotificationCategory::create($attributes); } From 1bfe16b572a053e27ad9a3be24fb12b3d7b1864f Mon Sep 17 00:00:00 2001 From: Tom Witkowski Date: Mon, 6 Feb 2017 10:35:00 +0000 Subject: [PATCH 08/24] Apply fixes from StyleCI [ci skip] [skip ci] --- tests/NotifynderTestCase.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/NotifynderTestCase.php b/tests/NotifynderTestCase.php index 015797e..c3954bd 100644 --- a/tests/NotifynderTestCase.php +++ b/tests/NotifynderTestCase.php @@ -90,7 +90,7 @@ protected function createCategory(array $attributes = []) ], $attributes); $category = NotificationCategory::byName($attributes['name'])->first(); - if($category instanceof NotificationCategory) { + if ($category instanceof NotificationCategory) { return $category; } From 886a75ea8c988f2c72ed147658c73c4a42f0e20d Mon Sep 17 00:00:00 2001 From: Tom Witkowski Date: Mon, 6 Feb 2017 11:43:35 +0100 Subject: [PATCH 09/24] try to optimize build matrix --- .travis.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.travis.yml b/.travis.yml index 2965193..64be547 100644 --- a/.travis.yml +++ b/.travis.yml @@ -51,6 +51,10 @@ matrix: env: LARAVEL_VERSION="dev-master" - php: 5.6 env: LARAVEL_VERSION="dev-master" + - php: nightly + env: DB_TYPE="mysql" + - php: hhvm + env: DB_TYPE="mysql" allow_failures: - php: nightly - php: hhvm From 2227b3976e9bff23f7a944df8b81cc5596ded977 Mon Sep 17 00:00:00 2001 From: Tom Witkowski Date: Mon, 6 Feb 2017 11:43:57 +0100 Subject: [PATCH 10/24] fix last mysql constrains related test errors --- tests/NotifynderTestCase.php | 3 +++ tests/integration/Traits/NotifableTest.php | 10 ++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/tests/NotifynderTestCase.php b/tests/NotifynderTestCase.php index 015797e..32699a3 100644 --- a/tests/NotifynderTestCase.php +++ b/tests/NotifynderTestCase.php @@ -7,6 +7,7 @@ use Illuminate\Database\Eloquent\Model; use Fenos\Notifynder\NotifynderServiceProvider; use Fenos\Notifynder\Models\NotificationCategory; +use Fenos\Notifynder\Models\Notification; use Orchestra\Testbench\TestCase as OrchestraTestCase; use Fenos\Notifynder\Facades\Notifynder as NotifynderFacade; @@ -68,6 +69,8 @@ protected function getEnvironmentSetUp($app) public function tearDown() { app('db')->rollback(); + NotificationCategory::truncate(); + Notification::truncate(); } protected function getApplicationTimezone($app) diff --git a/tests/integration/Traits/NotifableTest.php b/tests/integration/Traits/NotifableTest.php index cbe91ca..0805574 100644 --- a/tests/integration/Traits/NotifableTest.php +++ b/tests/integration/Traits/NotifableTest.php @@ -21,29 +21,31 @@ public function testNotifynder() public function testSendNotificationFrom() { + $category = $this->createCategory(); $user = $this->createUser(); - $notifynder = $user->sendNotificationFrom(1); + $notifynder = $user->sendNotificationFrom($category->getKey()); $this->assertInstanceOf(NotifynderManager::class, $notifynder); $notifynder->to(2); $builder = $notifynder->builder(); $this->assertInstanceOf(Builder::class, $builder); $notification = $builder->getNotification(); $this->assertInstanceOf(Notification::class, $notification); - $this->assertSame(1, $notification->category_id); + $this->assertSame($category->getKey(), $notification->category_id); $this->assertSame(1, $notification->from_id); } public function testSendNotificationTo() { + $category = $this->createCategory(); $user = $this->createUser(); - $notifynder = $user->sendNotificationTo(1); + $notifynder = $user->sendNotificationTo($category->getKey()); $this->assertInstanceOf(NotifynderManager::class, $notifynder); $notifynder->from(2); $builder = $notifynder->builder(); $this->assertInstanceOf(Builder::class, $builder); $notification = $builder->getNotification(); $this->assertInstanceOf(Notification::class, $notification); - $this->assertSame(1, $notification->category_id); + $this->assertSame($category->getKey(), $notification->category_id); $this->assertSame(1, $notification->to_id); $notifynder->send(); $this->assertCount(1, $user->getNotificationRelation); From e4a059f29d4f057a43c78945cafed15caaf52279 Mon Sep 17 00:00:00 2001 From: Tom Witkowski Date: Mon, 6 Feb 2017 10:44:11 +0000 Subject: [PATCH 11/24] Apply fixes from StyleCI [ci skip] [skip ci] --- tests/NotifynderTestCase.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/NotifynderTestCase.php b/tests/NotifynderTestCase.php index 6d77ccc..e13302c 100644 --- a/tests/NotifynderTestCase.php +++ b/tests/NotifynderTestCase.php @@ -5,9 +5,9 @@ use Fenos\Tests\Models\CarL53; use Fenos\Tests\Models\UserL53; use Illuminate\Database\Eloquent\Model; +use Fenos\Notifynder\Models\Notification; use Fenos\Notifynder\NotifynderServiceProvider; use Fenos\Notifynder\Models\NotificationCategory; -use Fenos\Notifynder\Models\Notification; use Orchestra\Testbench\TestCase as OrchestraTestCase; use Fenos\Notifynder\Facades\Notifynder as NotifynderFacade; From f3783e4d54c35b55d844f724a6ba5785d3d15ece Mon Sep 17 00:00:00 2001 From: Tom Witkowski Date: Mon, 6 Feb 2017 11:49:24 +0100 Subject: [PATCH 12/24] fix truncate order --- tests/NotifynderTestCase.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/NotifynderTestCase.php b/tests/NotifynderTestCase.php index e13302c..8bb8165 100644 --- a/tests/NotifynderTestCase.php +++ b/tests/NotifynderTestCase.php @@ -69,8 +69,8 @@ protected function getEnvironmentSetUp($app) public function tearDown() { app('db')->rollback(); - NotificationCategory::truncate(); Notification::truncate(); + NotificationCategory::truncate(); } protected function getApplicationTimezone($app) From 88694302072bb8bd3f5ea7e677893505b2939645 Mon Sep 17 00:00:00 2001 From: Tom Witkowski Date: Mon, 6 Feb 2017 11:49:34 +0100 Subject: [PATCH 13/24] fix exclude envs --- .travis.yml | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 64be547..acdf891 100644 --- a/.travis.yml +++ b/.travis.yml @@ -52,9 +52,25 @@ matrix: - php: 5.6 env: LARAVEL_VERSION="dev-master" - php: nightly - env: DB_TYPE="mysql" + env: LARAVEL_VERSION="5.0.*" DB_TYPE="mysql" + - php: nightly + env: LARAVEL_VERSION="5.1.*" DB_TYPE="mysql" + - php: nightly + env: LARAVEL_VERSION="5.2.*" DB_TYPE="mysql" + - php: nightly + env: LARAVEL_VERSION="5.3.*" DB_TYPE="mysql" + - php: nightly + env: LARAVEL_VERSION="5.4.*" DB_TYPE="mysql" + - php: hhvm + env: LARAVEL_VERSION="5.0.*" DB_TYPE="mysql" + - php: hhvm + env: LARAVEL_VERSION="5.1.*" DB_TYPE="mysql" + - php: hhvm + env: LARAVEL_VERSION="5.2.*" DB_TYPE="mysql" + - php: hhvm + env: LARAVEL_VERSION="5.3.*" DB_TYPE="mysql" - php: hhvm - env: DB_TYPE="mysql" + env: LARAVEL_VERSION="5.4.*" DB_TYPE="mysql" allow_failures: - php: nightly - php: hhvm From 9b92cb8730f2491c59b7e9fe2edd01148f95d9e4 Mon Sep 17 00:00:00 2001 From: Tom Witkowski Date: Mon, 6 Feb 2017 11:56:43 +0100 Subject: [PATCH 14/24] #263 remove php5.5 from fulltest list --- .travis.yml | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index acdf891..842f6f5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,7 +19,6 @@ services: ## List all PHP versions to test with php: - - 5.5 - 5.6 - 7.0 - 7.1 @@ -38,17 +37,14 @@ env: - LARAVEL_VERSION="5.3.*" DB_TYPE="mysql" - LARAVEL_VERSION="5.4.*" DB_TYPE="sqlite" - LARAVEL_VERSION="5.4.*" DB_TYPE="mysql" - - LARAVEL_VERSION="dev-master" + - LARAVEL_VERSION="dev-master" DB_TYPE="sqlite" matrix: fast_finish: true - exclude: - - php: 5.5 - env: LARAVEL_VERSION="5.3.*" - - php: 5.5 - env: LARAVEL_VERSION="5.4.*" + include: - php: 5.5 - env: LARAVEL_VERSION="dev-master" + env: LARAVEL_VERSION="5.1.*" DB_TYPE="mysql" + exclude: - php: 5.6 env: LARAVEL_VERSION="dev-master" - php: nightly From 7ec7f8f1cc2eec1a40674cb67e29b7477d3990d5 Mon Sep 17 00:00:00 2001 From: Tom Witkowski Date: Mon, 6 Feb 2017 11:57:06 +0100 Subject: [PATCH 15/24] ignore constraints to truncate models on tearDown --- tests/NotifynderTestCase.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/NotifynderTestCase.php b/tests/NotifynderTestCase.php index 8bb8165..09fa05e 100644 --- a/tests/NotifynderTestCase.php +++ b/tests/NotifynderTestCase.php @@ -69,8 +69,10 @@ protected function getEnvironmentSetUp($app) public function tearDown() { app('db')->rollback(); + app('db')->statement('SET FOREIGN_KEY_CHECKS=0;'); Notification::truncate(); NotificationCategory::truncate(); + app('db')->statement('SET FOREIGN_KEY_CHECKS=1;'); } protected function getApplicationTimezone($app) From 5863c176189f5f15fca5c51a43a366de628ecf49 Mon Sep 17 00:00:00 2001 From: Tom Witkowski Date: Mon, 6 Feb 2017 12:01:20 +0100 Subject: [PATCH 16/24] fix last assert id errors --- tests/integration/Traits/NotifableTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/integration/Traits/NotifableTest.php b/tests/integration/Traits/NotifableTest.php index 0805574..99e81f1 100644 --- a/tests/integration/Traits/NotifableTest.php +++ b/tests/integration/Traits/NotifableTest.php @@ -31,7 +31,7 @@ public function testSendNotificationFrom() $notification = $builder->getNotification(); $this->assertInstanceOf(Notification::class, $notification); $this->assertSame($category->getKey(), $notification->category_id); - $this->assertSame(1, $notification->from_id); + $this->assertSame($user->getKey(), $notification->from_id); } public function testSendNotificationTo() @@ -46,7 +46,7 @@ public function testSendNotificationTo() $notification = $builder->getNotification(); $this->assertInstanceOf(Notification::class, $notification); $this->assertSame($category->getKey(), $notification->category_id); - $this->assertSame(1, $notification->to_id); + $this->assertSame($user->getKey(), $notification->to_id); $notifynder->send(); $this->assertCount(1, $user->getNotificationRelation); } From 6b42b4d02fe6045271d73849c960ff0cfe00b0df Mon Sep 17 00:00:00 2001 From: Tom Witkowski Date: Mon, 6 Feb 2017 12:07:59 +0100 Subject: [PATCH 17/24] execute SET just on mysql --- tests/NotifynderTestCase.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/NotifynderTestCase.php b/tests/NotifynderTestCase.php index 09fa05e..477d418 100644 --- a/tests/NotifynderTestCase.php +++ b/tests/NotifynderTestCase.php @@ -69,10 +69,14 @@ protected function getEnvironmentSetUp($app) public function tearDown() { app('db')->rollback(); - app('db')->statement('SET FOREIGN_KEY_CHECKS=0;'); + if(app('db')->getDriverName() == 'mysql') { + app('db')->statement('SET FOREIGN_KEY_CHECKS=0;'); + } Notification::truncate(); NotificationCategory::truncate(); - app('db')->statement('SET FOREIGN_KEY_CHECKS=1;'); + if(app('db')->getDriverName() == 'mysql') { + app('db')->statement('SET FOREIGN_KEY_CHECKS=1;'); + } } protected function getApplicationTimezone($app) From 0a70664997a4ea8857723f69ea1f5b740265d6cc Mon Sep 17 00:00:00 2001 From: Tom Witkowski Date: Mon, 6 Feb 2017 11:08:08 +0000 Subject: [PATCH 18/24] Apply fixes from StyleCI [ci skip] [skip ci] --- tests/NotifynderTestCase.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/NotifynderTestCase.php b/tests/NotifynderTestCase.php index 477d418..d1fa2d9 100644 --- a/tests/NotifynderTestCase.php +++ b/tests/NotifynderTestCase.php @@ -69,12 +69,12 @@ protected function getEnvironmentSetUp($app) public function tearDown() { app('db')->rollback(); - if(app('db')->getDriverName() == 'mysql') { + if (app('db')->getDriverName() == 'mysql') { app('db')->statement('SET FOREIGN_KEY_CHECKS=0;'); } Notification::truncate(); NotificationCategory::truncate(); - if(app('db')->getDriverName() == 'mysql') { + if (app('db')->getDriverName() == 'mysql') { app('db')->statement('SET FOREIGN_KEY_CHECKS=1;'); } } From 7a0de6defaa42a85fe2b87e02462450c1c699047 Mon Sep 17 00:00:00 2001 From: Tom Witkowski Date: Mon, 6 Feb 2017 12:12:54 +0100 Subject: [PATCH 19/24] execute truncate just on mysql --- tests/NotifynderTestCase.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tests/NotifynderTestCase.php b/tests/NotifynderTestCase.php index 477d418..b7ee071 100644 --- a/tests/NotifynderTestCase.php +++ b/tests/NotifynderTestCase.php @@ -71,10 +71,8 @@ public function tearDown() app('db')->rollback(); if(app('db')->getDriverName() == 'mysql') { app('db')->statement('SET FOREIGN_KEY_CHECKS=0;'); - } - Notification::truncate(); - NotificationCategory::truncate(); - if(app('db')->getDriverName() == 'mysql') { + Notification::truncate(); + NotificationCategory::truncate(); app('db')->statement('SET FOREIGN_KEY_CHECKS=1;'); } } From 76218e2134e93e3feaaa90f34d996c01d632b771 Mon Sep 17 00:00:00 2001 From: Tom Witkowski Date: Mon, 6 Feb 2017 11:13:26 +0000 Subject: [PATCH 20/24] Apply fixes from StyleCI [ci skip] [skip ci] --- tests/NotifynderTestCase.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/NotifynderTestCase.php b/tests/NotifynderTestCase.php index b7ee071..4d9a200 100644 --- a/tests/NotifynderTestCase.php +++ b/tests/NotifynderTestCase.php @@ -69,7 +69,7 @@ protected function getEnvironmentSetUp($app) public function tearDown() { app('db')->rollback(); - if(app('db')->getDriverName() == 'mysql') { + if (app('db')->getDriverName() == 'mysql') { app('db')->statement('SET FOREIGN_KEY_CHECKS=0;'); Notification::truncate(); NotificationCategory::truncate(); From 775fad5bcb8c6a71ff8d0f5b2f2c97ce2da4bfb8 Mon Sep 17 00:00:00 2001 From: Tom Witkowski Date: Mon, 6 Feb 2017 12:23:53 +0100 Subject: [PATCH 21/24] fix enc exclude --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 842f6f5..07dbd4c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -46,7 +46,7 @@ matrix: env: LARAVEL_VERSION="5.1.*" DB_TYPE="mysql" exclude: - php: 5.6 - env: LARAVEL_VERSION="dev-master" + env: LARAVEL_VERSION="dev-master" DB_TYPE="sqlite" - php: nightly env: LARAVEL_VERSION="5.0.*" DB_TYPE="mysql" - php: nightly From 72d619fa3ebcc78ade930e000e3162e804707a2f Mon Sep 17 00:00:00 2001 From: Tom Witkowski Date: Mon, 6 Feb 2017 12:35:44 +0100 Subject: [PATCH 22/24] fix suggest --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index da44b2d..53feab7 100644 --- a/composer.json +++ b/composer.json @@ -29,7 +29,7 @@ "codeclimate/php-test-reporter": "^0.3.2", "satooshi/php-coveralls": "^1.0" }, - "suggests": { + "suggest": { "astrotomic/notifynder-sender-email": "Allows to send notifications as email.", "astrotomic/notifynder-sender-redis": "Allows to send notifications via Redis (Pub/Sub).", "astrotomic/notifynder-sender-slack": "Allows to send notifications via Slack.", From 3223a557f7be9853552569b52db8bbc9fb4d82e3 Mon Sep 17 00:00:00 2001 From: Tom Witkowski Date: Mon, 6 Feb 2017 12:37:04 +0100 Subject: [PATCH 23/24] optimize build matrix --- .travis.yml | 31 ++++--------------------------- 1 file changed, 4 insertions(+), 27 deletions(-) diff --git a/.travis.yml b/.travis.yml index 07dbd4c..5cc0d28 100644 --- a/.travis.yml +++ b/.travis.yml @@ -28,49 +28,26 @@ php: ## Define all ENV vars to test with env: - LARAVEL_VERSION="5.0.*" DB_TYPE="sqlite" - - LARAVEL_VERSION="5.0.*" DB_TYPE="mysql" - LARAVEL_VERSION="5.1.*" DB_TYPE="sqlite" - - LARAVEL_VERSION="5.1.*" DB_TYPE="mysql" - LARAVEL_VERSION="5.2.*" DB_TYPE="sqlite" - - LARAVEL_VERSION="5.2.*" DB_TYPE="mysql" - LARAVEL_VERSION="5.3.*" DB_TYPE="sqlite" - - LARAVEL_VERSION="5.3.*" DB_TYPE="mysql" - LARAVEL_VERSION="5.4.*" DB_TYPE="sqlite" - - LARAVEL_VERSION="5.4.*" DB_TYPE="mysql" - - LARAVEL_VERSION="dev-master" DB_TYPE="sqlite" matrix: fast_finish: true include: - php: 5.5 env: LARAVEL_VERSION="5.1.*" DB_TYPE="mysql" - exclude: - php: 5.6 - env: LARAVEL_VERSION="dev-master" DB_TYPE="sqlite" - - php: nightly - env: LARAVEL_VERSION="5.0.*" DB_TYPE="mysql" - - php: nightly - env: LARAVEL_VERSION="5.1.*" DB_TYPE="mysql" - - php: nightly - env: LARAVEL_VERSION="5.2.*" DB_TYPE="mysql" - - php: nightly - env: LARAVEL_VERSION="5.3.*" DB_TYPE="mysql" - - php: nightly - env: LARAVEL_VERSION="5.4.*" DB_TYPE="mysql" - - php: hhvm - env: LARAVEL_VERSION="5.0.*" DB_TYPE="mysql" - - php: hhvm env: LARAVEL_VERSION="5.1.*" DB_TYPE="mysql" - - php: hhvm - env: LARAVEL_VERSION="5.2.*" DB_TYPE="mysql" - - php: hhvm - env: LARAVEL_VERSION="5.3.*" DB_TYPE="mysql" - - php: hhvm + - php: 7.1 env: LARAVEL_VERSION="5.4.*" DB_TYPE="mysql" + - php: 7.1 + env: LARAVEL_VERSION="dev-master" DB_TYPE="sqlite" allow_failures: - php: nightly - php: hhvm - - env: LARAVEL_VERSION="dev-master" + - env: LARAVEL_VERSION="dev-master" DB_TYPE="sqlite" ## Run Scripts before Install before_install: From 207ddaef3d4d9c77e2bde33fab86c6aa5ddcd012 Mon Sep 17 00:00:00 2001 From: Tom Witkowski Date: Mon, 6 Feb 2017 12:39:06 +0100 Subject: [PATCH 24/24] optimize build matrix --- .travis.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5cc0d28..20e2db3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -27,27 +27,27 @@ php: ## Define all ENV vars to test with env: - - LARAVEL_VERSION="5.0.*" DB_TYPE="sqlite" - - LARAVEL_VERSION="5.1.*" DB_TYPE="sqlite" - - LARAVEL_VERSION="5.2.*" DB_TYPE="sqlite" - - LARAVEL_VERSION="5.3.*" DB_TYPE="sqlite" - - LARAVEL_VERSION="5.4.*" DB_TYPE="sqlite" + - LARAVEL_VERSION="5.0.*" + - LARAVEL_VERSION="5.1.*" + - LARAVEL_VERSION="5.2.*" + - LARAVEL_VERSION="5.3.*" + - LARAVEL_VERSION="5.4.*" matrix: fast_finish: true include: - php: 5.5 - env: LARAVEL_VERSION="5.1.*" DB_TYPE="mysql" + env: LARAVEL_VERSION="5.1.*" - php: 5.6 env: LARAVEL_VERSION="5.1.*" DB_TYPE="mysql" - php: 7.1 env: LARAVEL_VERSION="5.4.*" DB_TYPE="mysql" - php: 7.1 - env: LARAVEL_VERSION="dev-master" DB_TYPE="sqlite" + env: LARAVEL_VERSION="dev-master" allow_failures: - php: nightly - php: hhvm - - env: LARAVEL_VERSION="dev-master" DB_TYPE="sqlite" + - env: LARAVEL_VERSION="dev-master" ## Run Scripts before Install before_install: