22
33namespace Office365 ;
44
5- use Office365 \Runtime \Auth \AADTokenProvider ;
6- use Office365 \Runtime \Auth \UserCredentials ;
75use PHPUnit \Framework \TestCase ;
86
97
@@ -25,25 +23,19 @@ public static function setUpBeforeClass(): void
2523 {
2624 self ::$ settings = include (__DIR__ . '/Settings.php ' );
2725 self ::$ testAccountName = self ::$ settings ['TestAccountName ' ];
28- self ::$ graphClient = new GraphServiceClient (function () {
29- return self ::acquireToken ();
30- });
26+ self ::$ graphClient = GraphServiceClient::withUserCredentials (
27+ self ::$ settings ['TenantName ' ],
28+ self ::$ settings ['ClientId ' ],
29+ self ::$ settings ['UserName ' ],
30+ self ::$ settings ['Password ' ]
31+ );
3132 }
3233
3334 public static function tearDownAfterClass (): void
3435 {
3536 self ::$ graphClient = null ;
3637 }
3738
38-
39- public static function acquireToken ()
40- {
41- $ resource = "https://graph.microsoft.com " ;
42- $ provider = new AADTokenProvider (self ::$ settings ['TenantName ' ]);
43- return $ provider ->acquireTokenForPassword ($ resource , self ::$ settings ['ClientId ' ],
44- new UserCredentials (self ::$ settings ['UserName ' ], self ::$ settings ['Password ' ]));
45- }
46-
4739 public static function createUniqueName ($ prefix ){
4840 return $ prefix . "_ " . rand (1 , 100000 );
4941 }
0 commit comments