Files
opnform-host-nginx/tests/Feature/Forms/HideBrandingOnUpgradeTest.php
Favour Olayinka bec8e86b59 2f3fd laravel 11 upgrade (#436)
* fix password reset bug

* upgrade to  laravel 11

* composer.lock

* fix migration issues

* use ValidationRule Contract

* rename password_resets table

* implemented casts as protected function

* update env variables

* fix optional property

* fix validation issues

* use <env> on php unit xml

* fix pint

* cmposer.lock

* composer json fixes

* fix composer dependencies, remove  faker

* remove unused class

* remove test class

* fix default value for mysql migration

* linting

* expression syntax fix

---------

Co-authored-by: Julien Nahum <julien@nahum.net>
2024-06-10 16:10:14 +02:00

36 lines
1.0 KiB
PHP

<?php
use Illuminate\Support\Str;
it('can hide branding on upgrade', function () {
$user = $this->actingAsUser();
// Create workspaces and forms
for ($i = 0; $i < 3; $i++) {
$workspace = $this->createUserWorkspace($user);
for ($j = 0; $j < 3; $j++) {
$this->createForm($user, $workspace);
}
}
// Forms don't have branding removed when created
$forms = $user->workspaces()->with('forms')->get()->pluck('forms')->flatten();
$forms->each(function ($form) {
$this->assertEquals($form->no_branding, false);
});
// User subscribes
$user->subscriptions()->create([
'type' => 'default',
'stripe_id' => Str::random(),
'stripe_status' => 'active',
'stripe_price' => Str::random(),
'quantity' => 1,
]);
// Forms have branding removed after subscription
$forms = $user->workspaces()->with('forms')->get()->pluck('forms')->flatten();
$forms->each(function ($form) {
$this->assertEquals($form->no_branding, true);
});
});