Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal-3174996
Manage
Activity
Members
Labels
Plan
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Issue forks
drupal-3174996
Commits
b7fc0553
Commit
b7fc0553
authored
11 years ago
by
Angie Byron
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#2050843
by Berdir, sun, Vasiliy Grotov: Users 0 and 1 are created without a UUID.
parent
ae4177b8
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
core/modules/user/lib/Drupal/user/Tests/UserInstallTest.php
+61
-0
61 additions, 0 deletions
core/modules/user/lib/Drupal/user/Tests/UserInstallTest.php
core/modules/user/user.install
+4
-3
4 additions, 3 deletions
core/modules/user/user.install
with
65 additions
and
3 deletions
core/modules/user/lib/Drupal/user/Tests/UserInstallTest.php
0 → 100644
+
61
−
0
View file @
b7fc0553
<?php
/**
* @file
* Contains \Drupal\user\Tests\UserInstallTest.
*/
namespace
Drupal\user\Tests
;
use
Drupal\simpletest\DrupalUnitTestBase
;
/**
* Tests user_install().
*/
class
UserInstallTest
extends
DrupalUnitTestBase
{
/**
* Modules to enable.
*
* @var array
*/
public
static
$modules
=
array
(
'user'
);
/**
* {@inheritdoc}
*/
public
static
function
getInfo
()
{
return
array
(
'name'
=>
'User install tests'
,
'description'
=>
'Tests user_install().'
,
'group'
=>
'User'
);
}
/**
* {@inheritdoc}
*/
protected
function
setUp
()
{
parent
::
setUp
();
$this
->
installSchema
(
'user'
,
array
(
'users'
));
}
/**
* Test that the initial users have correct values.
*/
public
function
testUserInstall
()
{
user_install
();
$anon
=
db_query
(
'SELECT * FROM {users} WHERE uid = 0'
)
->
fetchObject
();
$admin
=
db_query
(
'SELECT * FROM {users} WHERE uid = 1'
)
->
fetchObject
();
$this
->
assertFalse
(
empty
(
$anon
->
uuid
),
'Anon user has a UUID'
);
$this
->
assertFalse
(
empty
(
$admin
->
uuid
),
'Admin user has a UUID'
);
$this
->
assertEqual
(
$anon
->
langcode
,
language_default
()
->
id
,
'Anon user language is the default.'
);
$this
->
assertEqual
(
$admin
->
langcode
,
language_default
()
->
id
,
'Admin user language is the default.'
);
$this
->
assertEqual
(
$admin
->
status
,
1
,
'Admin user is active.'
);
$this
->
assertEqual
(
$anon
->
status
,
0
,
'Anon user is blocked.'
);
}
}
This diff is collapsed.
Click to expand it.
core/modules/user/user.install
+
4
−
3
View file @
b7fc0553
...
...
@@ -231,18 +231,19 @@ function user_install() {
db_insert
(
'users'
)
->
fields
(
array
(
'uid'
=>
0
,
'uuid'
=>
\Drupal
::
service
(
'uuid'
)
->
generate
(),
'name'
=>
''
,
'mail'
=>
''
,
'langcode'
=>
language_default
()
->
id
,
))
->
execute
();
// We need some placeholders here as name and mail are uniques and data is
// presumed to be a serialized array. This will be changed by the settings
// form in the installer.
// We need some placeholders here as name and mail are uniques.
// This will be changed by the settings form in the installer.
db_insert
(
'users'
)
->
fields
(
array
(
'uid'
=>
1
,
'uuid'
=>
\Drupal
::
service
(
'uuid'
)
->
generate
(),
'name'
=>
'placeholder-for-uid-1'
,
'mail'
=>
'placeholder-for-uid-1'
,
'created'
=>
REQUEST_TIME
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment