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
feat: Establish a dedicated testing environment with `.env.testing`, `CreatesApplication` trait, and `Language` model factory, integrating language selection into user profile tests and adjusting the `languages` table migration.
Paulo Castellanod72c07665836
diff --git a/.env.testing b/.env.testingnew file mode 100644index 000000000..f1d8986ad--- /dev/null+++ b/.env.testing@@ -0,0 +1,40 @@+APP_NAME="Trypost.it"+APP_ENV=testing+APP_KEY=base64:oWfTqkX5cJwaVV7c8/z9xjC4XLGzbsKmjSgZiHtvxlk=+APP_DEBUG=true+APP_URL=https://trypost.test++DB_CONNECTION=pgsql+DB_HOST=127.0.0.1+DB_PORT=5432+DB_DATABASE=trypost_test+DB_USERNAME=root+DB_PASSWORD=++# Test credentials for social platforms+LINKEDIN_CLIENT_ID=test-linkedin-client-id+LINKEDIN_CLIENT_SECRET=test-linkedin-client-secret++X_CLIENT_ID=test-x-client-id+X_CLIENT_SECRET=test-x-client-secret++TIKTOK_CLIENT_ID=test-tiktok-client-id+TIKTOK_CLIENT_SECRET=test-tiktok-client-secret++FACEBOOK_CLIENT_ID=test-facebook-client-id+FACEBOOK_CLIENT_SECRET=test-facebook-client-secret++INSTAGRAM_CLIENT_ID=test-instagram-client-id+INSTAGRAM_CLIENT_SECRET=test-instagram-client-secret++THREADS_CLIENT_ID=test-threads-client-id+THREADS_CLIENT_SECRET=test-threads-client-secret++GOOGLE_CLIENT_ID=test-google-client-id+GOOGLE_CLIENT_SECRET=test-google-client-secret++PINTEREST_CLIENT_ID=test-pinterest-client-id+PINTEREST_CLIENT_SECRET=test-pinterest-client-secret++UNSPLASH_ACCESS_KEY=test-unsplash-access-key+UNSPLASH_SECRET_KEY=test-unsplash-secret-key\ No newline at end of filediff --git a/app/Models/Language.php b/app/Models/Language.phpindex bebc8ba67..44a38a8b2 100644--- a/app/Models/Language.php+++ b/app/Models/Language.php@@ -3,12 +3,13 @@namespace App\Models;use Illuminate\Database\Eloquent\Concerns\HasUuids;+use Illuminate\Database\Eloquent\Factories\HasFactory;use Illuminate\Database\Eloquent\Model;use Illuminate\Database\Eloquent\Relations\HasMany;class Language extends Model{- use HasUuids;+ use HasFactory, HasUuids;protected $fillable = ['name',diff --git a/database/factories/LanguageFactory.php b/database/factories/LanguageFactory.phpnew file mode 100644index 000000000..0ae513ad2--- /dev/null+++ b/database/factories/LanguageFactory.php@@ -0,0 +1,24 @@+<?php++namespace Database\Factories;++use Illuminate\Database\Eloquent\Factories\Factory;++/**+ * @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Language>+*/+class LanguageFactory extends Factory+{+ /**+ * Define the model's default state.+ *+ * @return array<string, mixed>+ */+ public function definition(): array+ {+ return [+ 'name' => 'English',+ 'code' => 'en-US',+ ];+ }+}diff --git a/database/factories/UserFactory.php b/database/factories/UserFactory.phpindex 80da5ac7e..cba2d87bc 100644--- a/database/factories/UserFactory.php+++ b/database/factories/UserFactory.php@@ -2,6 +2,7 @@namespace Database\Factories;+use App\Models\Language;use Illuminate\Database\Eloquent\Factories\Factory;use Illuminate\Support\Facades\Hash;use Illuminate\Support\Str;@@ -29,6 +30,7 @@ class UserFactory extends Factory'email_verified_at' => now(),'password' => static::$password ??= Hash::make('password'),'remember_token' => Str::random(10),+ 'language_id' => Language::factory(),'two_factor_secret' => null,'two_factor_recovery_codes' => null,'two_factor_confirmed_at' => null,diff --git a/database/migrations/0001_01_01_000000_create_users_table.php b/database/migrations/0001_01_01_000000_create_users_table.phpindex 1e583ee32..03dc3353d 100644--- a/database/migrations/0001_01_01_000000_create_users_table.php+++ b/database/migrations/0001_01_01_000000_create_users_table.php@@ -14,7 +14,7 @@ return new class extends MigrationSchema::create('languages', function (Blueprint $table) {$table->uuid('id')->primary();$table->string('name');- $table->string('code')->unique();+ $table->string('code');$table->timestamps();});diff --git a/phpunit.xml b/phpunit.xmlindex 88b9d18b6..63face99f 100644--- a/phpunit.xml+++ b/phpunit.xml@@ -28,6 +28,7 @@<env name="QUEUE_CONNECTION" value="sync"/><env name="SESSION_DRIVER" value="array"/><env name="PULSE_ENABLED" value="false"/>+ <env name="FILESYSTEM_DISK" value="local"/><env name="TELESCOPE_ENABLED" value="false"/><env name="NIGHTWATCH_ENABLED" value="false"/></php>diff --git a/tests/CreatesApplication.php b/tests/CreatesApplication.phpnew file mode 100644index 000000000..117f0c91c--- /dev/null+++ b/tests/CreatesApplication.php@@ -0,0 +1,23 @@+<?php++declare(strict_types=1);++namespace Tests;++use Illuminate\Contracts\Console\Kernel;+use Illuminate\Foundation\Application;++trait CreatesApplication+{+ /**+ * Creates the application.+ */+ public function createApplication(): Application+ {+ $app = require __DIR__.'/../bootstrap/app.php';++ $app->make(Kernel::class)->bootstrap();++ return $app;+ }+}diff --git a/tests/Feature/Settings/ProfileUpdateTest.php b/tests/Feature/Settings/ProfileUpdateTest.phpindex b4c4c3784..08226fb4a 100644--- a/tests/Feature/Settings/ProfileUpdateTest.php+++ b/tests/Feature/Settings/ProfileUpdateTest.php@@ -20,6 +20,7 @@ test('profile information can be updated', function () {->patch(route('profile.update'), ['name' => 'Test User','email' => '[email protected]',+ 'language_id' => $user->language_id,]);$response@@ -41,6 +42,7 @@ test('email verification status is unchanged when the email address is unchanged->patch(route('profile.update'), ['name' => 'Test User','email' => $user->email,+ 'language_id' => $user->language_id,]);$responsediff --git a/tests/TestCase.php b/tests/TestCase.phpindex dcf2e89ee..29e8ad387 100644--- a/tests/TestCase.php+++ b/tests/TestCase.php@@ -8,6 +8,8 @@ use Illuminate\Foundation\Testing\TestCase as BaseTestCase;abstract class TestCase extends BaseTestCase{+ use CreatesApplication;+/*** Indicates whether the default seeder should run before each test.*