Code Duplication    Length = 9-16 lines in 3 locations

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

@@ 842-850 (lines=9) @@
839
    /**
840
     * Test for creating user with Active Directory login name.
841
     */
842
    public function testNewUserWithDomainName()
843
    {
844
        $repository = $this->getRepository();
845
        $userService = $repository->getUserService();
846
        $createdUser = $this->createUserVersion1('ez-user-Domain\username-by-login');
847
        $loadedUser = $userService->loadUserByLogin('ez-user-Domain\username-by-login');
848
849
        $this->assertEquals($createdUser, $loadedUser);
850
    }
851
852
    /**
853
     * Test for the createUser() method.
@@ 1430-1444 (lines=15) @@
1427
     * @see \eZ\Publish\API\Repository\UserService::loadUsersByEmail()
1428
     * @depends eZ\Publish\API\Repository\Tests\UserServiceTest::testCreateUser
1429
     */
1430
    public function testLoadUserByEmail()
1431
    {
1432
        $repository = $this->getRepository();
1433
1434
        $userService = $repository->getUserService();
1435
1436
        /* BEGIN: Use Case */
1437
        $user = $this->createUserVersion1();
1438
1439
        // Load the newly created user
1440
        $usersReloaded = $userService->loadUsersByEmail('[email protected]');
1441
        /* END: Use Case */
1442
1443
        $this->assertEquals(array($user), $usersReloaded);
1444
    }
1445
1446
    /**
1447
     * Test for the loadUsersByEmail() method.
@@ 1452-1467 (lines=16) @@
1449
     * @see \eZ\Publish\API\Repository\UserService::loadUsersByEmail()
1450
     * @depends eZ\Publish\API\Repository\Tests\UserServiceTest::testLoadUserByEmail
1451
     */
1452
    public function testLoadUserByEmailReturnsEmptyInUnknownEmail()
1453
    {
1454
        $repository = $this->getRepository();
1455
1456
        $userService = $repository->getUserService();
1457
1458
        /* BEGIN: Use Case */
1459
        $this->createUserVersion1();
1460
1461
        // This call will return empty array, because the given
1462
        // login/password combination does not exist.
1463
        $emptyUserList = $userService->loadUsersByEmail('[email protected]');
1464
        /* END: Use Case */
1465
1466
        $this->assertEquals(array(), $emptyUserList);
1467
    }
1468
1469
    /**
1470
     * Test for the deleteUser() method.