Skip to content

Commit

Permalink
Updated for Laravel 8
Browse files Browse the repository at this point in the history
  • Loading branch information
Philipp committed Nov 10, 2020
1 parent f18a254 commit bba7215
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 35 deletions.
1 change: 1 addition & 0 deletions .phpunit.result.cache
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
C:37:"PHPUnit\Runner\DefaultTestResultCache":6578:{a:2:{s:7:"defects";a:37:{s:62:"Musonza\Chat\Tests\ConversationTest::it_creates_a_conversation";i:4;s:75:"Musonza\Chat\Tests\ConversationTest::it_returns_a_conversation_given_the_id";i:4;s:71:"Musonza\Chat\Tests\ConversationTest::it_can_mark_a_conversation_as_read";i:4;s:71:"Musonza\Chat\Tests\ConversationTest::it_can_update_conversation_details";i:4;s:64:"Musonza\Chat\Tests\ConversationTest::it_can_clear_a_conversation";i:4;s:83:"Musonza\Chat\Tests\ConversationTest::it_can_create_a_conversation_between_two_users";i:4;s:79:"Musonza\Chat\Tests\ConversationTest::it_can_return_a_conversation_between_users";i:4;s:82:"Musonza\Chat\Tests\ConversationTest::it_can_remove_a_single_user_from_conversation";i:4;s:83:"Musonza\Chat\Tests\ConversationTest::it_can_remove_multiple_users_from_conversation";i:4;s:77:"Musonza\Chat\Tests\ConversationTest::it_can_add_a_single_user_to_conversation";i:4;s:78:"Musonza\Chat\Tests\ConversationTest::it_can_add_multiple_users_to_conversation";i:3;s:84:"Musonza\Chat\Tests\ConversationTest::it_can_return_a_common_conversation_among_users";i:4;s:79:"Musonza\Chat\Tests\ConversationTest::it_can_return_conversation_recent_messsage";i:4;s:107:"Musonza\Chat\Tests\ConversationTest::it_returns_last_message_as_null_when_the_very_last_message_was_deleted";i:4;s:82:"Musonza\Chat\Tests\ConversationTest::it_returns_correct_attributes_in_last_message";i:4;s:112:"Musonza\Chat\Tests\ConversationTest::it_returns_the_correct_order_of_conversations_when_updated_at_is_duplicated";i:4;s:85:"Musonza\Chat\Tests\ConversationTest::it_allows_setting_private_or_public_conversation";i:4;s:93:"Musonza\Chat\Tests\ConversationTest::it_converts_at_least_3_participants_to_public_by_default";i:4;s:101:"Musonza\Chat\Tests\ConversationTest::converting_at_least_three_participants_to_public_is_configurable";i:4;s:69:"Musonza\Chat\Tests\ConversationTest::it_filters_conversations_by_type";i:4;s:77:"Musonza\Chat\Tests\ConversationTest::it_specifies_fields_to_return_for_sender";i:4;s:53:"Musonza\Chat\Tests\MessageTest::it_can_send_a_message";i:4;s:65:"Musonza\Chat\Tests\MessageTest::it_returns_a_message_given_the_id";i:4;s:72:"Musonza\Chat\Tests\MessageTest::it_can_send_a_message_and_specificy_type";i:4;s:61:"Musonza\Chat\Tests\MessageTest::it_can_mark_a_message_as_read";i:4;s:55:"Musonza\Chat\Tests\MessageTest::it_can_delete_a_message";i:4;s:60:"Musonza\Chat\Tests\MessageTest::it_can_list_deleted_messages";i:4;s:58:"Musonza\Chat\Tests\MessageTest::it_can_tell_message_sender";i:4;s:82:"Musonza\Chat\Tests\MessageTest::it_can_return_paginated_messages_in_a_conversation";i:4;s:67:"Musonza\Chat\Tests\MessageTest::it_can_return_recent_user_messsages";i:4;s:72:"Musonza\Chat\Tests\MessageTest::it_return_unread_messages_count_for_user";i:4;s:55:"Musonza\Chat\Tests\MessageTest::it_gets_a_message_by_id";i:4;s:50:"Musonza\Chat\Tests\MessageTest::it_flags_a_message";i:4;s:69:"Musonza\Chat\Tests\NotificationsTest::it_creates_message_notification";i:4;s:70:"Musonza\Chat\Tests\NotificationsTest::it_gets_all_unread_notifications";i:4;s:83:"Musonza\Chat\Tests\NotificationsTest::it_gets_unread_notifications_per_conversation";i:4;s:63:"Musonza\Chat\Tests\PaginationTest::it_can_set_pagination_params";i:4;}s:5:"times";a:37:{s:62:"Musonza\Chat\Tests\ConversationTest::it_creates_a_conversation";d:0.615;s:75:"Musonza\Chat\Tests\ConversationTest::it_returns_a_conversation_given_the_id";d:0.513;s:71:"Musonza\Chat\Tests\ConversationTest::it_can_mark_a_conversation_as_read";d:0.484;s:71:"Musonza\Chat\Tests\ConversationTest::it_can_update_conversation_details";d:0.512;s:64:"Musonza\Chat\Tests\ConversationTest::it_can_clear_a_conversation";d:0.482;s:83:"Musonza\Chat\Tests\ConversationTest::it_can_create_a_conversation_between_two_users";d:0.46;s:79:"Musonza\Chat\Tests\ConversationTest::it_can_return_a_conversation_between_users";d:0.505;s:82:"Musonza\Chat\Tests\ConversationTest::it_can_remove_a_single_user_from_conversation";d:0.483;s:83:"Musonza\Chat\Tests\ConversationTest::it_can_remove_multiple_users_from_conversation";d:0.47;s:77:"Musonza\Chat\Tests\ConversationTest::it_can_add_a_single_user_to_conversation";d:0.551;s:78:"Musonza\Chat\Tests\ConversationTest::it_can_add_multiple_users_to_conversation";d:0.873;s:84:"Musonza\Chat\Tests\ConversationTest::it_can_return_a_common_conversation_among_users";d:0.528;s:79:"Musonza\Chat\Tests\ConversationTest::it_can_return_conversation_recent_messsage";d:0.477;s:107:"Musonza\Chat\Tests\ConversationTest::it_returns_last_message_as_null_when_the_very_last_message_was_deleted";d:0.47;s:82:"Musonza\Chat\Tests\ConversationTest::it_returns_correct_attributes_in_last_message";d:0.484;s:112:"Musonza\Chat\Tests\ConversationTest::it_returns_the_correct_order_of_conversations_when_updated_at_is_duplicated";d:0.498;s:85:"Musonza\Chat\Tests\ConversationTest::it_allows_setting_private_or_public_conversation";d:0.484;s:93:"Musonza\Chat\Tests\ConversationTest::it_converts_at_least_3_participants_to_public_by_default";d:0.637;s:101:"Musonza\Chat\Tests\ConversationTest::converting_at_least_three_participants_to_public_is_configurable";d:0.646;s:69:"Musonza\Chat\Tests\ConversationTest::it_filters_conversations_by_type";d:0.603;s:77:"Musonza\Chat\Tests\ConversationTest::it_specifies_fields_to_return_for_sender";d:0.704;s:53:"Musonza\Chat\Tests\MessageTest::it_can_send_a_message";d:0.532;s:65:"Musonza\Chat\Tests\MessageTest::it_returns_a_message_given_the_id";d:0.544;s:72:"Musonza\Chat\Tests\MessageTest::it_can_send_a_message_and_specificy_type";d:0.543;s:61:"Musonza\Chat\Tests\MessageTest::it_can_mark_a_message_as_read";d:1.043;s:55:"Musonza\Chat\Tests\MessageTest::it_can_delete_a_message";d:0.515;s:60:"Musonza\Chat\Tests\MessageTest::it_can_list_deleted_messages";d:0.613;s:58:"Musonza\Chat\Tests\MessageTest::it_can_tell_message_sender";d:0.507;s:82:"Musonza\Chat\Tests\MessageTest::it_can_return_paginated_messages_in_a_conversation";d:0.501;s:67:"Musonza\Chat\Tests\MessageTest::it_can_return_recent_user_messsages";d:0.53;s:72:"Musonza\Chat\Tests\MessageTest::it_return_unread_messages_count_for_user";d:0.581;s:55:"Musonza\Chat\Tests\MessageTest::it_gets_a_message_by_id";d:0.558;s:50:"Musonza\Chat\Tests\MessageTest::it_flags_a_message";d:0.534;s:69:"Musonza\Chat\Tests\NotificationsTest::it_creates_message_notification";d:0.539;s:70:"Musonza\Chat\Tests\NotificationsTest::it_gets_all_unread_notifications";d:0.5;s:83:"Musonza\Chat\Tests\NotificationsTest::it_gets_unread_notifications_per_conversation";d:0.47;s:63:"Musonza\Chat\Tests\PaginationTest::it_can_set_pagination_params";d:0.51;}}}
9 changes: 4 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,12 @@
"conversation"
],
"require": {
"php": "^7.1.3|^7.2",
"laravel/framework": "~5.8.0|^6.0|^7.0"
"php": "^7.3.0",
"laravel/framework": "^8.0"
},
"require-dev": {
"phpunit/phpunit": "^7.0|^8.0",
"orchestra/testbench": "^3.8|^4.0|^5.0",
"orchestra/database": "^3.8|^4.0|^5.0",
"phpunit/phpunit": "^9.0",
"orchestra/testbench": "^6.0",
"mockery/mockery": "^1.0.0"
},
"license": "MIT",
Expand Down
26 changes: 0 additions & 26 deletions database/factories/ModelFactory.php

This file was deleted.

32 changes: 32 additions & 0 deletions database/factories/UserFactory.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

namespace Database\Factories\Musonza\Chat;

use Musonza\Chat\User;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Str;

class UserFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = User::class;

/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
return [
'name' => $this->faker->name,
'email' => $this->faker->unique()->safeEmail,
'password' => bcrypt('secret'),
'remember_token' => Str::random(10),
];
}
}
3 changes: 3 additions & 0 deletions src/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@
namespace Musonza\Chat;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;

class User extends Model
{
use HasFactory;

protected $primaryKey = 'uid';
}
9 changes: 5 additions & 4 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

namespace Musonza\Chat\Tests;

require __DIR__.'/../database/migrations/create_chat_tables.php';
require __DIR__ . '/../database/migrations/create_chat_tables.php';
require __DIR__ . '/../database/factories/UserFactory.php';

use CreateChatTables;
use Illuminate\Database\Schema\Blueprint;
Expand All @@ -24,7 +25,7 @@ public function setUp(): void
parent::setUp();

$this->artisan('migrate', ['--database' => 'testbench']);
$this->withFactories(__DIR__.'/../database/factories');
// $this->withFactories(__DIR__ . '/../database/factories');
$this->migrate();
$this->users = $this->createUsers(6);
}
Expand Down Expand Up @@ -89,7 +90,7 @@ protected function getEnvironmentSetUp($app)
protected function getPackageProviders($app)
{
return [
\Orchestra\Database\ConsoleServiceProvider::class,
// \Orchestra\Database\ConsoleServiceProvider::class,
\Musonza\Chat\ChatServiceProvider::class,
];
}
Expand All @@ -103,7 +104,7 @@ protected function getPackageAliases($app)

public function createUsers($count = 1)
{
return factory(User::class, $count)->create();
return User::factory()->count($count)->create();
}

public function tearDown(): void
Expand Down

0 comments on commit bba7215

Please sign in to comment.