Skip to content

Open-source social media scheduler built for AI agents and the teams behind them. Create, schedule and publish posts to every network through MCP or the REST API, or write them yourself in a composer your team will love.

fix: update Socialite mocks in social controller tests

Paulo Castellano2fcf0a7e7a8f
diff --git a/tests/Feature/Social/FacebookControllerTest.php b/tests/Feature/Social/FacebookControllerTest.php
index d95cb690d..abb0d7472 100644
--- a/tests/Feature/Social/FacebookControllerTest.php
+++ b/tests/Feature/Social/FacebookControllerTest.php
@@ -20,14 +20,16 @@ beforeEach(function () {
});
test('facebook connect redirects to oauth provider', function () {
+ $driverMock = Mockery::mock();
+ $driverMock->shouldReceive('usingGraphVersion')->andReturnSelf();
+ $driverMock->shouldReceive('setScopes')->andReturnSelf();
+ $driverMock->shouldReceive('redirect')->andReturn(Mockery::mock([
+ 'getTargetUrl' => 'https://www.facebook.com/v25.0/dialog/oauth?test=1',
+ ]));
+
Socialite::shouldReceive('driver')
->with('facebook')
- ->andReturn(Mockery::mock([
- 'scopes' => Mockery::self(),
- 'redirect' => Mockery::mock([
- 'getTargetUrl' => 'https://www.facebook.com/v21.0/dialog/oauth?test=1',
- ]),
- ]));
+ ->andReturn($driverMock);
$response = $this->actingAs($this->user)
->withHeader('X-Inertia', 'true')
diff --git a/tests/Feature/Social/InstagramControllerTest.php b/tests/Feature/Social/InstagramControllerTest.php
index 20b3a2d87..b0117173d 100644
--- a/tests/Feature/Social/InstagramControllerTest.php
+++ b/tests/Feature/Social/InstagramControllerTest.php
@@ -19,14 +19,15 @@ beforeEach(function () {
});
test('instagram connect redirects to oauth provider', function () {
+ $driverMock = Mockery::mock();
+ $driverMock->shouldReceive('scopes')->andReturnSelf();
+ $driverMock->shouldReceive('redirect')->andReturn(Mockery::mock([
+ 'getTargetUrl' => 'https://www.instagram.com/oauth/authorize?test=1',
+ ]));
+
Socialite::shouldReceive('driver')
->with('instagram')
- ->andReturn(Mockery::mock([
- 'scopes' => Mockery::self(),
- 'redirect' => Mockery::mock([
- 'getTargetUrl' => 'https://www.instagram.com/oauth/authorize?test=1',
- ]),
- ]));
+ ->andReturn($driverMock);
$response = $this->actingAs($this->user)
->withHeader('X-Inertia', 'true')
diff --git a/tests/Feature/Social/LinkedInControllerTest.php b/tests/Feature/Social/LinkedInControllerTest.php
index 6ced6a712..26aee84aa 100644
--- a/tests/Feature/Social/LinkedInControllerTest.php
+++ b/tests/Feature/Social/LinkedInControllerTest.php
@@ -20,14 +20,15 @@ beforeEach(function () {
});
test('linkedin connect redirects to oauth provider', function () {
+ $driverMock = Mockery::mock();
+ $driverMock->shouldReceive('scopes')->andReturnSelf();
+ $driverMock->shouldReceive('redirect')->andReturn(Mockery::mock([
+ 'getTargetUrl' => 'https://www.linkedin.com/oauth/v2/authorization?test=1',
+ ]));
+
Socialite::shouldReceive('driver')
->with('linkedin')
- ->andReturn(Mockery::mock([
- 'scopes' => Mockery::self(),
- 'redirect' => Mockery::mock([
- 'getTargetUrl' => 'https://www.linkedin.com/oauth/v2/authorization?test=1',
- ]),
- ]));
+ ->andReturn($driverMock);
$response = $this->actingAs($this->user)
->withHeader('X-Inertia', 'true')
diff --git a/tests/Feature/Social/LinkedInPageControllerTest.php b/tests/Feature/Social/LinkedInPageControllerTest.php
index e4517af30..ce703bfab 100644
--- a/tests/Feature/Social/LinkedInPageControllerTest.php
+++ b/tests/Feature/Social/LinkedInPageControllerTest.php
@@ -20,15 +20,16 @@ beforeEach(function () {
});
test('linkedin page connect redirects to oauth provider', function () {
+ $driverMock = Mockery::mock();
+ $driverMock->shouldReceive('scopes')->andReturnSelf();
+ $driverMock->shouldReceive('with')->andReturnSelf();
+ $driverMock->shouldReceive('redirect')->andReturn(Mockery::mock([
+ 'getTargetUrl' => 'https://www.linkedin.com/oauth/v2/authorization?test=1',
+ ]));
+
Socialite::shouldReceive('driver')
->with('linkedin-openid')
- ->andReturn(Mockery::mock([
- 'scopes' => Mockery::self(),
- 'with' => Mockery::self(),
- 'redirect' => Mockery::mock([
- 'getTargetUrl' => 'https://www.linkedin.com/oauth/v2/authorization?test=1',
- ]),
- ]));
+ ->andReturn($driverMock);
$response = $this->actingAs($this->user)
->withHeader('X-Inertia', 'true')
diff --git a/tests/Feature/Social/PinterestControllerTest.php b/tests/Feature/Social/PinterestControllerTest.php
index 1ee6b7e4e..0336d742c 100644
--- a/tests/Feature/Social/PinterestControllerTest.php
+++ b/tests/Feature/Social/PinterestControllerTest.php
@@ -19,14 +19,15 @@ beforeEach(function () {
});
test('pinterest connect redirects to oauth provider', function () {
+ $driverMock = Mockery::mock();
+ $driverMock->shouldReceive('scopes')->andReturnSelf();
+ $driverMock->shouldReceive('redirect')->andReturn(Mockery::mock([
+ 'getTargetUrl' => 'https://www.pinterest.com/oauth?test=1',
+ ]));
+
Socialite::shouldReceive('driver')
->with('pinterest')
- ->andReturn(Mockery::mock([
- 'scopes' => Mockery::self(),
- 'redirect' => Mockery::mock([
- 'getTargetUrl' => 'https://www.pinterest.com/oauth?test=1',
- ]),
- ]));
+ ->andReturn($driverMock);
$response = $this->actingAs($this->user)
->withHeader('X-Inertia', 'true')
diff --git a/tests/Feature/Social/TikTokControllerTest.php b/tests/Feature/Social/TikTokControllerTest.php
index 707777b27..1df0a79f1 100644
--- a/tests/Feature/Social/TikTokControllerTest.php
+++ b/tests/Feature/Social/TikTokControllerTest.php
@@ -19,14 +19,15 @@ beforeEach(function () {
});
test('tiktok connect redirects to oauth provider', function () {
+ $driverMock = Mockery::mock();
+ $driverMock->shouldReceive('scopes')->andReturnSelf();
+ $driverMock->shouldReceive('redirect')->andReturn(Mockery::mock([
+ 'getTargetUrl' => 'https://www.tiktok.com/v2/auth/authorize?test=1',
+ ]));
+
Socialite::shouldReceive('driver')
->with('tiktok')
- ->andReturn(Mockery::mock([
- 'scopes' => Mockery::self(),
- 'redirect' => Mockery::mock([
- 'getTargetUrl' => 'https://www.tiktok.com/v2/auth/authorize?test=1',
- ]),
- ]));
+ ->andReturn($driverMock);
$response = $this->actingAs($this->user)
->withHeader('X-Inertia', 'true')
diff --git a/tests/Feature/Social/XControllerTest.php b/tests/Feature/Social/XControllerTest.php
index 1cdac1022..7af106d8e 100644
--- a/tests/Feature/Social/XControllerTest.php
+++ b/tests/Feature/Social/XControllerTest.php
@@ -19,14 +19,15 @@ beforeEach(function () {
});
test('x connect redirects to oauth provider', function () {
+ $driverMock = Mockery::mock();
+ $driverMock->shouldReceive('scopes')->andReturnSelf();
+ $driverMock->shouldReceive('redirect')->andReturn(Mockery::mock([
+ 'getTargetUrl' => 'https://twitter.com/i/oauth2/authorize?test=1',
+ ]));
+
Socialite::shouldReceive('driver')
->with('x')
- ->andReturn(Mockery::mock([
- 'scopes' => Mockery::self(),
- 'redirect' => Mockery::mock([
- 'getTargetUrl' => 'https://twitter.com/i/oauth2/authorize?test=1',
- ]),
- ]));
+ ->andReturn($driverMock);
$response = $this->actingAs($this->user)
->withHeader('X-Inertia', 'true')
diff --git a/tests/Feature/Social/YouTubeControllerTest.php b/tests/Feature/Social/YouTubeControllerTest.php
index 21db5603f..1d8532f77 100644
--- a/tests/Feature/Social/YouTubeControllerTest.php
+++ b/tests/Feature/Social/YouTubeControllerTest.php
@@ -20,15 +20,16 @@ beforeEach(function () {
});
test('youtube connect redirects to oauth provider', function () {
+ $driverMock = Mockery::mock();
+ $driverMock->shouldReceive('scopes')->andReturnSelf();
+ $driverMock->shouldReceive('with')->andReturnSelf();
+ $driverMock->shouldReceive('redirect')->andReturn(Mockery::mock([
+ 'getTargetUrl' => 'https://accounts.google.com/o/oauth2/v2/auth?test=1',
+ ]));
+
Socialite::shouldReceive('driver')
->with('google')
- ->andReturn(Mockery::mock([
- 'scopes' => Mockery::self(),
- 'with' => Mockery::self(),
- 'redirect' => Mockery::mock([
- 'getTargetUrl' => 'https://accounts.google.com/o/oauth2/v2/auth?test=1',
- ]),
- ]));
+ ->andReturn($driverMock);
$response = $this->actingAs($this->user)
->withHeader('X-Inertia', 'true')