forked from laravel-doctrine/orm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request laravel-doctrine#632 from TomHAnderson/feature/tes…
…t-namespace Feature/test namespace
- Loading branch information
Showing
72 changed files
with
603 additions
and
365 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?php | ||
|
||
namespace LaravelDoctrineTest\ORM\Assets; | ||
|
||
class AnotherListenerStub | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
|
||
namespace LaravelDoctrineTest\ORM\Assets\Auth; | ||
|
||
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract; | ||
use LaravelDoctrine\ORM\Auth\Authenticatable; | ||
|
||
class AuthenticableMock implements AuthenticatableContract | ||
{ | ||
use Authenticatable; | ||
|
||
public function __construct() | ||
{ | ||
$this->password = 'myPassword'; | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
tests/Assets/Auth/AuthenticableWithNonEmptyConstructorMock.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
|
||
namespace LaravelDoctrineTest\ORM\Assets\Auth; | ||
|
||
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract; | ||
use LaravelDoctrine\ORM\Auth\Authenticatable; | ||
|
||
class AuthenticableWithNonEmptyConstructorMock implements AuthenticatableContract | ||
{ | ||
use Authenticatable; | ||
|
||
public function __construct(array $passwords) | ||
{ | ||
$this->password = $passwords[0]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
namespace LaravelDoctrineTest\ORM\Assets\Auth\Passwords; | ||
|
||
use Illuminate\Contracts\Auth\CanResetPassword; | ||
|
||
class UserMock implements CanResetPassword | ||
{ | ||
/** | ||
* Get the e-mail address where password reset links are sent. | ||
* @return string | ||
*/ | ||
public function getEmailForPasswordReset() | ||
{ | ||
return 'user@mockery.mock'; | ||
} | ||
|
||
/** | ||
* Send the password reset notification. | ||
* | ||
* @param string $token | ||
* @return void | ||
*/ | ||
public function sendPasswordResetNotification($token) | ||
{ | ||
// TODO: Implement sendPasswordResetNotification() method. | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
|
||
namespace LaravelDoctrineTest\ORM\Assets\Configuration; | ||
|
||
use Doctrine\DBAL\Platforms\AbstractPlatform; | ||
use Doctrine\DBAL\Types\Type; | ||
|
||
class TypeMock extends Type | ||
{ | ||
public function getSQLDeclaration(array $column, AbstractPlatform $platform): string | ||
{ | ||
return ''; | ||
} | ||
|
||
public function getName() | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
|
||
namespace LaravelDoctrineTest\ORM\Assets\Configuration; | ||
|
||
use Doctrine\DBAL\Platforms\AbstractPlatform; | ||
use Doctrine\DBAL\Types\Type; | ||
|
||
class TypeMock2 extends Type | ||
{ | ||
public function getSQLDeclaration(array $column, AbstractPlatform $platform): string | ||
{ | ||
return ''; | ||
} | ||
|
||
public function getName() | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
|
||
namespace LaravelDoctrineTest\ORM\Assets; | ||
|
||
use Doctrine\ORM\Decorator\EntityManagerDecorator; | ||
|
||
class Decorator extends EntityManagerDecorator | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
|
||
namespace LaravelDoctrineTest\ORM\Assets\Entity; | ||
|
||
class Foo | ||
{ | ||
private $id; | ||
|
||
private $name; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
namespace LaravelDoctrineTest\ORM\Assets\Extensions; | ||
|
||
use Doctrine\Common\EventManager; | ||
use Doctrine\ORM\EntityManagerInterface; | ||
use LaravelDoctrine\ORM\Extensions\Extension; | ||
use LaravelDoctrineTest\ORM\Feature\Extensions\ExtensionManagerTest; | ||
|
||
class ExtensionMock implements Extension | ||
{ | ||
public function addSubscribers(EventManager $manager, EntityManagerInterface $em): void | ||
{ | ||
// Confirm it gets called | ||
(new ExtensionManagerTest)->assertTrue(true); | ||
} | ||
|
||
/** | ||
* @return mixed[] | ||
*/ | ||
public function getFilters(): array | ||
{ | ||
return []; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
namespace LaravelDoctrineTest\ORM\Assets\Extensions; | ||
|
||
use Doctrine\Common\EventManager; | ||
use Doctrine\ORM\EntityManagerInterface; | ||
use LaravelDoctrine\ORM\Extensions\Extension; | ||
|
||
class ExtensionMock2 implements Extension | ||
{ | ||
public function addSubscribers(EventManager $manager, EntityManagerInterface $em): void | ||
{ | ||
} | ||
|
||
/** | ||
* @return mixed[] | ||
*/ | ||
public function getFilters(): array | ||
{ | ||
return []; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
namespace LaravelDoctrineTest\ORM\Assets\Extensions; | ||
|
||
use Doctrine\Common\EventManager; | ||
use Doctrine\ORM\EntityManagerInterface; | ||
use LaravelDoctrine\ORM\Extensions\Extension; | ||
|
||
class ExtensionWithFiltersMock implements Extension | ||
{ | ||
public function addSubscribers(EventManager $manager, EntityManagerInterface $em): void | ||
{ | ||
} | ||
|
||
/** | ||
* @return mixed[] | ||
*/ | ||
public function getFilters(): array | ||
{ | ||
return [ | ||
'filter' => 'FilterMock', | ||
'filter2' => 'FilterMock' | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
|
||
namespace LaravelDoctrineTest\ORM\Assets; | ||
|
||
use Doctrine\DBAL\Connection; | ||
|
||
class FakeConnection extends Connection | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?php | ||
|
||
namespace LaravelDoctrineTest\ORM\Assets; | ||
|
||
class FakeEventManager extends \Doctrine\Common\EventManager | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
namespace LaravelDoctrineTest\ORM\Assets; | ||
|
||
class FilterStub extends \Doctrine\ORM\Query\Filter\SQLFilter | ||
{ | ||
public function addFilterConstraint(\Doctrine\ORM\Mapping\ClassMetadata $targetEntity, string $targetTableAlias): string | ||
{ | ||
return ''; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?php | ||
|
||
namespace LaravelDoctrineTest\ORM\Assets; | ||
|
||
class ListenerStub | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
|
||
namespace LaravelDoctrineTest\ORM\Assets\Middleware; | ||
|
||
class BindableEntity | ||
{ | ||
public $id; | ||
|
||
public $name; | ||
|
||
public function getId() | ||
{ | ||
return $this->id; | ||
} | ||
|
||
public function getName() | ||
{ | ||
return strtolower($this->name); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
namespace LaravelDoctrineTest\ORM\Assets\Middleware; | ||
|
||
class BindableEntityWithInterface implements \LaravelDoctrine\ORM\Contracts\UrlRoutable | ||
{ | ||
public $id; | ||
|
||
public $name; | ||
|
||
public function getId() | ||
{ | ||
return $this->id; | ||
} | ||
|
||
public function getName() | ||
{ | ||
return strtolower($this->name); | ||
} | ||
|
||
public static function getRouteKeyNameStatic(): string | ||
{ | ||
return 'name'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
namespace LaravelDoctrineTest\ORM\Assets\Middleware; | ||
|
||
use Illuminate\Http\Request; | ||
|
||
class EntityController | ||
{ | ||
public function index(BindableEntity $entity) | ||
{ | ||
return $entity->getName(); | ||
} | ||
|
||
public function interfacer(BindableEntityWithInterface $entity) | ||
{ | ||
return $entity->getId(); | ||
} | ||
|
||
public function returnValue(string $value) | ||
{ | ||
return $value; | ||
} | ||
|
||
public function returnEntity(BindableEntity $entity = null) { | ||
return $entity; | ||
} | ||
|
||
public function returnEntityName(BindableEntity $entity) { | ||
return $entity->getName(); | ||
} | ||
|
||
public function checkRequest(Request $request) { | ||
return $request instanceof Request ? 'request' : 'something else'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?php | ||
|
||
namespace LaravelDoctrineTest\ORM\Assets\Mock; | ||
|
||
class CountableEntityMock | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
{ | ||
} |
Oops, something went wrong.