|
8 | 8 | class PeopleManagerTest extends SharePointTestCase
|
9 | 9 | {
|
10 | 10 |
|
11 |
| - private static $accountName = "i:0#.f|membership|[email protected]"; |
| 11 | + /** |
| 12 | + * @var SharePoint\User |
| 13 | + */ |
| 14 | + private static $testUser; |
| 15 | + |
| 16 | + public static function setUpBeforeClass() |
| 17 | + { |
| 18 | + parent::setUpBeforeClass(); |
| 19 | + self::$testUser = self::$context->getWeb()->ensureUser(self::$testAccountName)->executeQuery(); |
| 20 | + } |
12 | 21 |
|
13 |
| - public function testGetMyProperties(){ |
| 22 | + public function testGetMyProperties() |
| 23 | + { |
14 | 24 | $peopleManager = new PeopleManager(self::$context);
|
15 | 25 | $properties = $peopleManager->getMyProperties()->get()->executeQuery();
|
16 | 26 | $this->assertNotNull($properties->getAccountName());
|
17 | 27 | }
|
18 | 28 |
|
19 | 29 |
|
20 |
| - public function testGetUserProfilePropertyFor(){ |
| 30 | + public function testGetUserProfilePropertyFor() |
| 31 | + { |
21 | 32 | $peopleManager = new PeopleManager(self::$context);
|
22 |
| - $result = $peopleManager->getUserProfilePropertyFor(self::$accountName,"AccountName"); |
| 33 | + $result = $peopleManager->getUserProfilePropertyFor(self::$testUser->getLoginName(), "AccountName"); |
23 | 34 | self::$context->executeQuery();
|
24 | 35 | $this->assertNotNull($result->getValue());
|
25 | 36 | }
|
26 | 37 |
|
27 | 38 |
|
28 |
| - public function testFollow(){ |
| 39 | + public function testFollow() |
| 40 | + { |
29 | 41 | $peopleManager = new PeopleManager(self::$context);
|
30 | 42 |
|
31 |
| - $result = $peopleManager->amIFollowing(self::$accountName); |
| 43 | + $result = $peopleManager->amIFollowing(self::$testUser->getLoginName()); |
32 | 44 | self::$context->executeQuery();
|
33 | 45 |
|
34 |
| - if($result->getValue() == false){ |
35 |
| - $peopleManager->follow(self::$accountName); |
| 46 | + if ($result->getValue() == false) { |
| 47 | + $peopleManager->follow(self::$testUser->getLoginName()); |
36 | 48 | self::$context->executeQuery();
|
37 | 49 | }
|
38 | 50 |
|
39 |
| - $propertiesList = $peopleManager->getFollowersFor(self::$accountName); |
| 51 | + $propertiesList = $peopleManager->getFollowersFor(self::$testUser->getLoginName()); |
40 | 52 | self::$context->load($propertiesList);
|
41 | 53 | self::$context->executeQuery();
|
42 | 54 |
|
43 |
| - self::assertGreaterThanOrEqual(1,$propertiesList->getCount()); |
| 55 | + self::assertGreaterThanOrEqual(1, $propertiesList->getCount()); |
44 | 56 | }
|
45 | 57 |
|
46 |
| - public function testStopFollowing(){ |
| 58 | + public function testStopFollowing() |
| 59 | + { |
47 | 60 | $peopleManager = new PeopleManager(self::$context);
|
48 | 61 |
|
49 |
| - $result = $peopleManager->amIFollowing(self::$accountName); |
| 62 | + $result = $peopleManager->amIFollowing(self::$testUser->getLoginName()); |
50 | 63 | self::$context->executeQuery();
|
51 | 64 |
|
52 |
| - if($result->getValue() == true){ |
53 |
| - $peopleManager->stopFollowing(self::$accountName); |
| 65 | + if ($result->getValue() == true) { |
| 66 | + $peopleManager->stopFollowing(self::$testUser->getLoginName()); |
54 | 67 | self::$context->executeQuery();
|
55 | 68 | }
|
56 | 69 |
|
57 | 70 |
|
58 |
| - $result2 = $peopleManager->amIFollowing(self::$accountName); |
| 71 | + $result2 = $peopleManager->amIFollowing(self::$testUser->getLoginName()); |
59 | 72 | self::$context->executeQuery();
|
60 | 73 | self::assertFalse($result2->getValue());
|
61 | 74 | }
|
62 | 75 |
|
63 | 76 |
|
64 |
| - public function testAmIFollowedBy(){ |
| 77 | + public function testAmIFollowedBy() |
| 78 | + { |
65 | 79 | $peopleManager = new PeopleManager(self::$context);
|
66 |
| - $result = $peopleManager->amIFollowedBy(self::$accountName); |
| 80 | + $result = $peopleManager->amIFollowedBy(self::$testUser->getLoginName()); |
67 | 81 | self::$context->executeQuery();
|
68 | 82 | self::assertNotNull($result->getValue());
|
69 | 83 | }
|
|
0 commit comments