Last active
September 17, 2018 21:25
-
-
Save burzum/4177bd19124014cc8ec4e8c072c83fff to your computer and use it in GitHub Desktop.
This file contains hidden or 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
<?php | |
namespace Authentication\Test\TestCase\Identifier\Resolver; | |
use Authentication\Identifier\Resolver\EloquentResolver; | |
use Authentication\Test\TestCase\AuthenticationTestCase; | |
use Illuminate\Database\Capsule\Manager as Capsule; | |
use Illuminate\Database\Connection; | |
use Illuminate\Database\ConnectionResolverInterface; | |
use Illuminate\Database\Eloquent\Model; | |
/** | |
* User Model | |
*/ | |
class UserModel extends Model { | |
} | |
/** | |
* EloquentResolverTest | |
*/ | |
class EloquentResolverTest extends AuthenticationTestCase | |
{ | |
/** | |
* @inheritDoc | |
*/ | |
public function setUp(): void | |
{ | |
parent::setUp(); | |
} | |
/** | |
* testFindDefault | |
* | |
* @return void | |
*/ | |
public function testFindDefault(): void | |
{ | |
$resolverMock = $this->getMockBuilder(ConnectionResolverInterface::class) | |
->getMock(); | |
UserModel::setConnectionResolver($resolverMock); | |
$connection = new Connection($this->getConnection()->getConnection()); | |
$resolverMock->expects($this->any()) | |
->method('getDefaultConnection') | |
->willReturn($this->returnValue($connection)); | |
$model = new UserModel(); | |
$model->setTable('users'); | |
$model->setConnection('default'); | |
$resolver = new EloquentResolver($model); | |
$result = $resolver->find([ | |
'username' => 'florian' | |
]); | |
var_dump($result); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment