Skip to content

Commit

Permalink
Added namespace to Notifications tests
Browse files Browse the repository at this point in the history
  • Loading branch information
TomHAnderson committed Oct 27, 2024
1 parent a824ad0 commit a597aeb
Show file tree
Hide file tree
Showing 7 changed files with 71 additions and 37 deletions.
15 changes: 15 additions & 0 deletions tests/Assets/Notifications/CustomNotifiableStub.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

namespace LaravelDoctrineTest\ORM\Assets\Notifications;

use LaravelDoctrine\ORM\Notifications\Notifiable;

class CustomNotifiableStub
{
use Notifiable;

public function routeNotificationForDoctrine()
{
return 'custom';
}
}
11 changes: 11 additions & 0 deletions tests/Assets/Notifications/NotifiableStub.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

namespace LaravelDoctrineTest\ORM\Assets\Notifications;

use LaravelDoctrine\ORM\Notifications\Notifiable;

class NotifiableStub
{
use Notifiable;
}

11 changes: 11 additions & 0 deletions tests/Assets/Notifications/NotificationDatabaseStub.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

namespace LaravelDoctrineTest\ORM\Assets\Notifications;

class NotificationDatabaseStub extends \Illuminate\Notifications\Notification
{
public function toDatabase()
{
return (new \LaravelDoctrine\ORM\Notifications\Notification());
}
}
7 changes: 7 additions & 0 deletions tests/Assets/Notifications/NotificationInvalidStub.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

namespace LaravelDoctrineTest\ORM\Assets\Notifications;

class NotificationInvalidStub extends \Illuminate\Notifications\Notification
{
}
11 changes: 11 additions & 0 deletions tests/Assets/Notifications/NotificationStub.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

namespace LaravelDoctrineTest\ORM\Assets\Notifications;

class NotificationStub extends \Illuminate\Notifications\Notification
{
public function toEntity()
{
return (new \LaravelDoctrine\ORM\Notifications\Notification());
}
}
45 changes: 9 additions & 36 deletions tests/Feature/Notifications/DoctrineChannelTest.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
<?php

namespace LaravelDoctrineTest\ORM\Feature\Notifications;

use Doctrine\ORM\EntityManagerInterface;
use Doctrine\Persistence\ManagerRegistry;
use LaravelDoctrine\ORM\Exceptions\NoEntityManagerFound;
use LaravelDoctrine\ORM\Notifications\DoctrineChannel;
use LaravelDoctrine\ORM\Notifications\Notifiable;
use LaravelDoctrineTest\ORM\Assets\Notifications\CustomNotifiableStub;
use LaravelDoctrineTest\ORM\Assets\Notifications\NotifiableStub;
use LaravelDoctrineTest\ORM\Assets\Notifications\NotificationDatabaseStub;
use LaravelDoctrineTest\ORM\Assets\Notifications\NotificationInvalidStub;
use LaravelDoctrineTest\ORM\Assets\Notifications\NotificationStub;
use Mockery;
use Mockery\Mock;
use PHPUnit\Framework\TestCase;
use RuntimeException;

class DoctrineChannelTest extends TestCase
{
Expand Down Expand Up @@ -90,38 +98,3 @@ public function test_it_should_throw_exception_when_it_does_not_find_an_em()
$this->channel->send(new CustomNotifiableStub(), new NotificationStub());
}
}

class NotificationStub extends \Illuminate\Notifications\Notification
{
public function toEntity()
{
return (new \LaravelDoctrine\ORM\Notifications\Notification);
}
}

class NotificationDatabaseStub extends \Illuminate\Notifications\Notification
{
public function toDatabase()
{
return (new \LaravelDoctrine\ORM\Notifications\Notification);
}
}

class NotificationInvalidStub extends \Illuminate\Notifications\Notification
{
}

class NotifiableStub
{
use Notifiable;
}

class CustomNotifiableStub
{
use Notifiable;

public function routeNotificationForDoctrine()
{
return 'custom';
}
}
8 changes: 7 additions & 1 deletion tests/Feature/Notifications/NotificationTest.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
<?php

namespace LaravelDoctrineTest\ORM\Feature\Notifications;

use Doctrine\ORM\EntityManagerInterface;
use LaravelDoctrine\ORM\Notifications\Notification;
use Mockery;
use Mockery\Mock;
use PHPUnit\Framework\TestCase;
use ReflectionClass;
use stdClass;

class NotificationTest extends TestCase
{
Expand All @@ -23,7 +29,7 @@ public function setUp(): void

public function testClassFunctions()
{
$entity = new \LaravelDoctrine\ORM\Notifications\Notification();
$entity = new Notification();

$entity->success();
$this->assertEquals('success', $entity->getLevel());
Expand Down

0 comments on commit a597aeb

Please sign in to comment.