Skip to content

Commit bba7215

Browse files
author
Philipp
committed
Updated for Laravel 8
1 parent f18a254 commit bba7215

File tree

6 files changed

+45
-35
lines changed

6 files changed

+45
-35
lines changed

.phpunit.result.cache

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
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;}}}

composer.json

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,12 @@
99
"conversation"
1010
],
1111
"require": {
12-
"php": "^7.1.3|^7.2",
13-
"laravel/framework": "~5.8.0|^6.0|^7.0"
12+
"php": "^7.3.0",
13+
"laravel/framework": "^8.0"
1414
},
1515
"require-dev": {
16-
"phpunit/phpunit": "^7.0|^8.0",
17-
"orchestra/testbench": "^3.8|^4.0|^5.0",
18-
"orchestra/database": "^3.8|^4.0|^5.0",
16+
"phpunit/phpunit": "^9.0",
17+
"orchestra/testbench": "^6.0",
1918
"mockery/mockery": "^1.0.0"
2019
},
2120
"license": "MIT",

database/factories/ModelFactory.php

Lines changed: 0 additions & 26 deletions
This file was deleted.

database/factories/UserFactory.php

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
3+
namespace Database\Factories\Musonza\Chat;
4+
5+
use Musonza\Chat\User;
6+
use Illuminate\Database\Eloquent\Factories\Factory;
7+
use Illuminate\Support\Str;
8+
9+
class UserFactory extends Factory
10+
{
11+
/**
12+
* The name of the factory's corresponding model.
13+
*
14+
* @var string
15+
*/
16+
protected $model = User::class;
17+
18+
/**
19+
* Define the model's default state.
20+
*
21+
* @return array
22+
*/
23+
public function definition()
24+
{
25+
return [
26+
'name' => $this->faker->name,
27+
'email' => $this->faker->unique()->safeEmail,
28+
'password' => bcrypt('secret'),
29+
'remember_token' => Str::random(10),
30+
];
31+
}
32+
}

src/User.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,11 @@
33
namespace Musonza\Chat;
44

55
use Illuminate\Database\Eloquent\Model;
6+
use Illuminate\Database\Eloquent\Factories\HasFactory;
67

78
class User extends Model
89
{
10+
use HasFactory;
11+
912
protected $primaryKey = 'uid';
1013
}

tests/TestCase.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
namespace Musonza\Chat\Tests;
44

5-
require __DIR__.'/../database/migrations/create_chat_tables.php';
5+
require __DIR__ . '/../database/migrations/create_chat_tables.php';
6+
require __DIR__ . '/../database/factories/UserFactory.php';
67

78
use CreateChatTables;
89
use Illuminate\Database\Schema\Blueprint;
@@ -24,7 +25,7 @@ public function setUp(): void
2425
parent::setUp();
2526

2627
$this->artisan('migrate', ['--database' => 'testbench']);
27-
$this->withFactories(__DIR__.'/../database/factories');
28+
// $this->withFactories(__DIR__ . '/../database/factories');
2829
$this->migrate();
2930
$this->users = $this->createUsers(6);
3031
}
@@ -89,7 +90,7 @@ protected function getEnvironmentSetUp($app)
8990
protected function getPackageProviders($app)
9091
{
9192
return [
92-
\Orchestra\Database\ConsoleServiceProvider::class,
93+
// \Orchestra\Database\ConsoleServiceProvider::class,
9394
\Musonza\Chat\ChatServiceProvider::class,
9495
];
9596
}
@@ -103,7 +104,7 @@ protected function getPackageAliases($app)
103104

104105
public function createUsers($count = 1)
105106
{
106-
return factory(User::class, $count)->create();
107+
return User::factory()->count($count)->create();
107108
}
108109

109110
public function tearDown(): void

0 commit comments

Comments
 (0)