Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
EntityUserProvider example
$em
= DoctrineTestHelper::
createTestEntityManager
(
)
;
$this
->
createSchema
(
$em
)
;
$user1
=
new
User
(
1, 1, 'user1'
)
;
$user2
=
new
User
(
1, 2, 'user2'
)
;
$em
->
persist
(
$user1
)
;
$em
->
persist
(
$user2
)
;
$em
->
flush
(
)
;
$provider
=
new
EntityUserProvider
(
$this
->
getManager
(
$em
)
, 'Symfony\Bridge\Doctrine\Tests\Fixtures\User', 'name'
)
;
// try to change the user identity
$user1
->name = 'user2';
$this
->
assertSame
(
$user1
,
$provider
->
refreshUser
(
$user1
)
)
;
}
public
function
testLoadUserByIdentifier
(
)
{
$em
= DoctrineTestHelper::
createTestEntityManager
(
)
;
$this
->
createSchema
(
$em
)
;