/
UserStorageGatewayTest.php
71 lines (65 loc) · 2.26 KB
/
UserStorageGatewayTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<?php
/**
* This file is part of the eZ Publish Kernel package.
*
* @copyright Copyright (C) eZ Systems AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/
namespace eZ\Publish\Core\FieldType\Tests\Integration\User\UserStorage;
use eZ\Publish\Core\FieldType\Tests\Integration\BaseCoreFieldTypeIntegrationTest;
use eZ\Publish\Core\Repository\Values\User\User;
/**
* User Field Type external storage gateway tests.
*/
abstract class UserStorageGatewayTest extends BaseCoreFieldTypeIntegrationTest
{
/**
* @return \eZ\Publish\Core\FieldType\User\UserStorage\Gateway
*/
abstract protected function getGateway();
/**
* @return array
*/
public function providerForGetFieldData()
{
$expectedUserData = [
10 => [
'hasStoredLogin' => true,
'contentId' => 10,
'login' => 'anonymous',
'email' => 'nospam@ez.no',
'passwordHash' => '$2y$10$35gOSQs6JK4u4whyERaeUuVeQBi2TUBIZIfP7HEj7sfz.MxvTuOeC',
'passwordHashType' => User::PASSWORD_HASH_PHP_DEFAULT,
'enabled' => true,
'maxLogin' => 1000,
],
14 => [
'hasStoredLogin' => true,
'contentId' => 14,
'login' => 'admin',
'email' => 'spam@ez.no',
'passwordHash' => '$2y$10$FDn9NPwzhq85cLLxfD5Wu.L3SL3Z/LNCvhkltJUV0wcJj7ciJg2oy',
'passwordHashType' => User::PASSWORD_HASH_PHP_DEFAULT,
'enabled' => true,
'maxLogin' => 10,
],
];
return [
[null, 10, $expectedUserData[10]],
[21, null, $expectedUserData[10]],
[null, 14, $expectedUserData[14]],
[28, null, $expectedUserData[14]],
];
}
/**
* @dataProvider providerForGetFieldData
* @param int|null $fieldId
* @param int $userId
* @param array $expectedUserData
*/
public function testGetFieldData($fieldId, $userId, array $expectedUserData)
{
$data = $this->getGateway()->getFieldData($fieldId, $userId);
$this->assertEquals($expectedUserData, $data);
}
}