Skip to content

Commit e32498e

Browse files
committed
added console tests
1 parent 4caa970 commit e32498e

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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+
});
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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+
});

0 commit comments

Comments
 (0)