Code Duplication    Length = 9-16 lines in 3 locations

eZ/Publish/API/Repository/Tests/UserServiceTest.php 3 locations

@@ 880-888 (lines=9) @@
877
    /**
878
     * Test for creating user with Active Directory login name.
879
     */
880
    public function testNewUserWithDomainName()
881
    {
882
        $repository = $this->getRepository();
883
        $userService = $repository->getUserService();
884
        $createdUser = $this->createUserVersion1('ez-user-Domain\username-by-login');
885
        $loadedUser = $userService->loadUserByLogin('ez-user-Domain\username-by-login');
886
887
        $this->assertEquals($createdUser, $loadedUser);
888
    }
889
890
    /**
891
     * Test for the createUser() method.
@@ 1468-1482 (lines=15) @@
1465
     * @see \eZ\Publish\API\Repository\UserService::loadUsersByEmail()
1466
     * @depends eZ\Publish\API\Repository\Tests\UserServiceTest::testCreateUser
1467
     */
1468
    public function testLoadUserByEmail()
1469
    {
1470
        $repository = $this->getRepository();
1471
1472
        $userService = $repository->getUserService();
1473
1474
        /* BEGIN: Use Case */
1475
        $user = $this->createUserVersion1();
1476
1477
        // Load the newly created user
1478
        $usersReloaded = $userService->loadUsersByEmail('[email protected]');
1479
        /* END: Use Case */
1480
1481
        $this->assertEquals([$user], $usersReloaded);
1482
    }
1483
1484
    /**
1485
     * Test for the loadUsersByEmail() method.
@@ 1490-1505 (lines=16) @@
1487
     * @see \eZ\Publish\API\Repository\UserService::loadUsersByEmail()
1488
     * @depends eZ\Publish\API\Repository\Tests\UserServiceTest::testLoadUserByEmail
1489
     */
1490
    public function testLoadUserByEmailReturnsEmptyInUnknownEmail()
1491
    {
1492
        $repository = $this->getRepository();
1493
1494
        $userService = $repository->getUserService();
1495
1496
        /* BEGIN: Use Case */
1497
        $this->createUserVersion1();
1498
1499
        // This call will return empty array, because the given
1500
        // login/password combination does not exist.
1501
        $emptyUserList = $userService->loadUsersByEmail('[email protected]');
1502
        /* END: Use Case */
1503
1504
        $this->assertEquals([], $emptyUserList);
1505
    }
1506
1507
    /**
1508
     * Test for the deleteUser() method.