Mercurial > hg > cmmr2012-drupal-site
comparison core/modules/user/tests/src/Kernel/UserLegacyTest.php @ 5:12f9dff5fda9 tip
Update to Drupal core 8.7.1
author | Chris Cannam |
---|---|
date | Thu, 09 May 2019 15:34:47 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
4:a9cd425dd02b | 5:12f9dff5fda9 |
---|---|
1 <?php | |
2 | |
3 namespace Drupal\Tests\user\Kernel; | |
4 | |
5 use Drupal\KernelTests\KernelTestBase; | |
6 use Drupal\user\Entity\User; | |
7 use Drupal\user\UserInterface; | |
8 | |
9 /** | |
10 * Tests legacy user functionality. | |
11 * | |
12 * @group user | |
13 * @group legacy | |
14 */ | |
15 class UserLegacyTest extends KernelTestBase { | |
16 | |
17 /** | |
18 * Modules to enable. | |
19 * | |
20 * @var array | |
21 */ | |
22 public static $modules = ['system', 'user', 'field']; | |
23 | |
24 /** | |
25 * {@inheritdoc} | |
26 */ | |
27 protected function setUp() { | |
28 parent::setUp(); | |
29 $this->installEntitySchema('user'); | |
30 } | |
31 | |
32 /** | |
33 * @expectedDeprecation user_load_multiple() is deprecated in Drupal 8.0.0 and will be removed before Drupal 9.0.0. Use \Drupal\user\Entity\User::loadMultiple(). See https://www.drupal.org/node/2266845 | |
34 * @expectedDeprecation user_load() is deprecated in Drupal 8.0.0 and will be removed before Drupal 9.0.0. Use \Drupal\user\Entity\User::load(). See https://www.drupal.org/node/2266845 | |
35 */ | |
36 public function testEntityLegacyCode() { | |
37 $this->installSchema('system', ['sequences']); | |
38 $this->assertCount(0, user_load_multiple()); | |
39 User::create(['name' => 'foo'])->save(); | |
40 $this->assertCount(1, user_load_multiple()); | |
41 User::create(['name' => 'bar'])->save(); | |
42 $this->assertCount(2, user_load_multiple()); | |
43 | |
44 $this->assertNull(user_load(300)); | |
45 $this->assertInstanceOf(UserInterface::class, user_load(1)); | |
46 } | |
47 | |
48 } |