Skip to content

Commit

Permalink
Alter the factories
Browse files Browse the repository at this point in the history
  • Loading branch information
3m1n3nc3 committed Feb 6, 2024
1 parent 5283a7d commit 98370ba
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
1 change: 0 additions & 1 deletion src/KudiSmsChannel.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ public function send($notifiable, Notification $notification)
try {
$to = $this->getTo($notifiable, $notification);
$message = $notification->toKudiSms($notifiable);

if (is_string($message)) {
$message = new KudiSmsMessage($message);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Feature/SendSmsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
expect(fn () => $user->notify(new SendSms("Hello {$user->name}! This is test SMS.")))
->not()
->toThrow(\Exception::class);
})->skip('Skipped for cost saving.');
});//->skip('Skipped for cost saving.');

test('user can recieve voice call.', function () {
$user = User::factory()->create();
Expand Down
12 changes: 6 additions & 6 deletions tests/Models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ class User extends Authenticatable
'remember_token',
];

// public function routeNotificationForKudiSms(): Attribute
public function routeNotificationForKudiSms()
{
return $this->phone;
}

// public function phoneNumber(): Attribute
// {
// return Attribute::make(fn () => $this->phone);
// }

public function phoneNumber(): Attribute
{
return Attribute::make(fn () => $this->phone);
}
}
3 changes: 2 additions & 1 deletion tests/database/factories/UserFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@ class UserFactory extends Factory
public function definition(): array
{
$phones = explode(',', config('kudi-notification.test_numbers'));
$seed = rand(0, count($phones) - 1);

return [
'name' => $this->faker->name(),
'email' => $this->faker->unique()->safeEmail(),
'phone' => $phones[rand(0, count($phones) - 1)] ?? $this->faker->phoneNumber,
'phone' => $phones[$seed] ?? $this->faker->phoneNumber,
'email_verified_at' => now(),
'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password
'remember_token' => Str::random(10),
Expand Down

0 comments on commit 98370ba

Please sign in to comment.