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.
PHP ai-agentsblueskyfacebookinstagramlaravellinkedinmastodonmcpmcp-serveropen-sourcerest-apiself-hostedsocial-mediasocial-media-managementsocial-media-schedulerthreadstiktokvuejsxyoutube
<?php
declare(strict_types=1);
use App\Actions\User\CreateUser;
use App\Models\Account;
use App\Models\User;
use App\Models\Workspace;
use Database\Seeders\PlanSeeder;
beforeEach(function () {
config(['trypost.self_hosted' => false]);
$this->seed(PlanSeeder::class);
});
test('user without subscription is redirected to subscribe', function () {
$user = CreateUser::execute([
'name' => 'Alice',
'email' => '[email protected]',
'password' => 'password123',
'registration_ip' => '127.0.0.1',
]);
$workspace = Workspace::factory()->create([
'account_id' => $user->account_id,
'user_id' => $user->id,
]);
$workspace->members()->attach($user->id, membershipPivot('member'));
$user->update(['current_workspace_id' => $workspace->id]);
$response = $this->actingAs($user->fresh())->get(route('app.workspace.channels'));
$response->assertRedirect(route('app.welcome.plan'));
});
test('user with active subscription can access the app', function () {
$user = CreateUser::execute([
'name' => 'Alice',
'email' => '[email protected]',
'password' => 'password123',
'registration_ip' => '127.0.0.1',
]);
$workspace = Workspace::factory()->create([
'account_id' => $user->account_id,
'user_id' => $user->id,
]);
$workspace->members()->attach($user->id, membershipPivot('member'));
$user->update(['current_workspace_id' => $workspace->id]);
$user->account->subscriptions()->create([
'type' => Account::SUBSCRIPTION_NAME,
'stripe_id' => 'sub_test_'.fake()->uuid(),
'stripe_status' => 'active',
'stripe_price' => 'price_123',
]);
$response = $this->actingAs($user->fresh())->get(route('app.workspace.channels'));
$response->assertOk();
});
test('user on trialing subscription (legacy trial-with-card) can access the app', function () {
$account = Account::factory()->create([
'trial_ends_at' => null,
'stripe_id' => 'cus_test_'.fake()->uuid(),
]);
$user = User::factory()->create(['account_id' => $account->id]);
$account->update(['owner_id' => $user->id]);
$account->subscriptions()->create([
'type' => Account::SUBSCRIPTION_NAME,
'stripe_id' => 'sub_test_'.fake()->uuid(),
'stripe_status' => 'trialing',
'stripe_price' => 'price_123',
'trial_ends_at' => now()->addDays(5),
]);
$workspace = Workspace::factory()->create([
'account_id' => $account->id,
'user_id' => $user->id,
]);
$workspace->members()->attach($user->id, membershipPivot('member'));
$user->update(['current_workspace_id' => $workspace->id]);
$response = $this->actingAs($user->fresh())->get(route('app.workspace.channels'));
$response->assertOk();
});
test('user with past_due subscription can access the app instead of being forced to subscribe', function () {
$account = Account::factory()->create([
'trial_ends_at' => null,
'stripe_id' => 'cus_test_'.fake()->uuid(),
]);
$user = User::factory()->create(['account_id' => $account->id]);
$account->update(['owner_id' => $user->id]);
$account->subscriptions()->create([
'type' => Account::SUBSCRIPTION_NAME,
'stripe_id' => 'sub_test_'.fake()->uuid(),
'stripe_status' => 'past_due',
'stripe_price' => 'price_123',
]);
$workspace = Workspace::factory()->create([
'account_id' => $account->id,
'user_id' => $user->id,
]);
$workspace->members()->attach($user->id, membershipPivot('member'));
$user->update(['current_workspace_id' => $workspace->id]);
$response = $this->actingAs($user->fresh())->get(route('app.workspace.channels'));
$response->assertOk();
$response->assertSessionMissing('errors');
});
test('a trial without a card can use the app until it ends', function () {
$user = CreateUser::execute([
'name' => 'Alice',
'email' => '[email protected]',
'password' => 'password123',
'registration_ip' => '127.0.0.1',
]);
$user->account->update(['trial_ends_at' => now()->addDays(7)]);
$workspace = Workspace::factory()->create([
'account_id' => $user->account_id,
'user_id' => $user->id,
]);
$workspace->members()->attach($user->id, membershipPivot('member'));
$user->update(['current_workspace_id' => $workspace->id]);
$this->actingAs($user->fresh())->get(route('app.workspace.channels'))->assertOk();
$this->travel(8)->days();
$this->actingAs($user->fresh())->get(route('app.workspace.channels'))->assertRedirect(route('app.welcome.plan'));
});