File tree Expand file tree Collapse file tree 2 files changed +44
-0
lines changed
Expand file tree Collapse file tree 2 files changed +44
-0
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+
3+ use Dcblogdev \MsGraph \Facades \MsGraphAdmin ;
4+
5+ test ('refreshes admin token when MsGraphAdmin is connected ' , function () {
6+ // Mock MsGraphAdmin::isConnected() to return true
7+ MsGraphAdmin::shouldReceive ('isConnected ' )->once ()->andReturn (true );
8+ MsGraphAdmin::shouldReceive ('getAccessToken ' )->once ()->with (true );
9+
10+ $ this ->artisan ('msgraphadmin:keep-alive ' )
11+ ->expectsOutput ('connected ' )
12+ ->assertExitCode (0 );
13+ });
14+
15+ test ('does nothing when MsGraphAdmin is not connected ' , function () {
16+ // Mock MsGraphAdmin::isConnected() to return false
17+ MsGraphAdmin::shouldReceive ('isConnected ' )->once ()->andReturn (false );
18+
19+ $ this ->artisan ('msgraphadmin:keep-alive ' )
20+ ->doesntExpectOutput ('connected ' )
21+ ->assertExitCode (0 );
22+ });
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ use Dcblogdev \MsGraph \Facades \MsGraph ;
4+
5+ test ('refreshes token when MsGraph is connected ' , function () {
6+ // Mock MsGraph::isConnected() to return true
7+ MsGraph::shouldReceive ('isConnected ' )->once ()->andReturn (true );
8+ MsGraph::shouldReceive ('getAccessToken ' )->once ()->with (null , false );
9+
10+ $ this ->artisan ('msgraph:keep-alive ' )
11+ ->expectsOutput ('connected ' )
12+ ->assertExitCode (0 );
13+ });
14+
15+ test ('does nothing when MsGraph is not connected ' , function () {
16+ // Mock MsGraph::isConnected() to return false
17+ MsGraph::shouldReceive ('isConnected ' )->once ()->andReturn (false );
18+
19+ $ this ->artisan ('msgraph:keep-alive ' )
20+ ->doesntExpectOutput ('connected ' )
21+ ->assertExitCode (0 );
22+ });
You can’t perform that action at this time.
0 commit comments