feat: VivesPOS landing on Winter CMS 1.2 — theme + plugin + Dockerfile
Some checks are pending
Module sub-split / Sub-split (push) Waiting to run
Some checks are pending
Module sub-split / Sub-split (push) Waiting to run
- Base: wintercms/winter branch 1.2 (full framework) - Theme vivespos: Canvas 7 + Bootstrap 5 CDN, custom CSS - Layout: deferred GTM/GA4 tracking, JSON-LD SoftwareApplication - Partials: hero (offline-first), features, modes (offline/nube toggle), screenshots, pricing (3 planes), comparison, FAQ, CTA - Plugin VivesPOS.Site with ContactForm - Dockerfile: PHP 8.2 Apache, port 80, healthcheck - Added winter/wn-pages, blog, sitemap, seo plugins - Active theme set to vivespos
This commit is contained in:
112
modules/system/tests/plugins/database/AttachOneModelTest.php
Normal file
112
modules/system/tests/plugins/database/AttachOneModelTest.php
Normal file
@@ -0,0 +1,112 @@
|
||||
<?php
|
||||
|
||||
namespace System\Tests\Plugins\Database;
|
||||
|
||||
use System\Tests\Bootstrap\PluginTestCase;
|
||||
use System\Models\File as FileModel;
|
||||
use Database\Tester\Models\User;
|
||||
use Database\Tester\Models\SoftDeleteUser;
|
||||
use Symfony\Component\HttpFoundation\File\UploadedFile;
|
||||
use Model;
|
||||
|
||||
class AttachOneModelTest extends PluginTestCase
|
||||
{
|
||||
public function setUp() : void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
include_once base_path() . '/modules/system/tests/fixtures/plugins/database/tester/models/User.php';
|
||||
|
||||
$this->runPluginRefreshCommand('Database.Tester');
|
||||
}
|
||||
|
||||
public function testSetRelationValue()
|
||||
{
|
||||
Model::unguard();
|
||||
$user = User::create(['name' => 'Stevie', 'email' => 'stevie@example.com']);
|
||||
$user2 = User::create(['name' => 'Joe', 'email' => 'joe@example.com']);
|
||||
Model::reguard();
|
||||
|
||||
// Set by string
|
||||
$user->avatar = base_path() . '/modules/system/tests/fixtures/plugins/database/tester/assets/images/avatar.png';
|
||||
|
||||
// @todo $user->avatar currently sits as a string, not good for validation
|
||||
// this should really assert as an UploadedFile instead.
|
||||
|
||||
// Commit the file and it should snap to a File model
|
||||
$user->save();
|
||||
|
||||
$this->assertNotNull($user->avatar);
|
||||
$this->assertEquals('avatar.png', $user->avatar->file_name);
|
||||
|
||||
// Set by Uploaded file
|
||||
$sample = $user->avatar;
|
||||
$upload = new UploadedFile(
|
||||
base_path() . '/modules/system/tests/fixtures/plugins/database/tester/assets/images/avatar.png',
|
||||
$sample->file_name,
|
||||
$sample->content_type,
|
||||
null,
|
||||
true
|
||||
);
|
||||
|
||||
$user2->avatar = $upload;
|
||||
|
||||
// The file is prepped but not yet commited, this is for validation
|
||||
$this->assertNotNull($user2->avatar);
|
||||
$this->assertEquals($upload, $user2->avatar);
|
||||
|
||||
// Commit the file and it should snap to a File model
|
||||
$user2->save();
|
||||
|
||||
$this->assertNotNull($user2->avatar);
|
||||
$this->assertEquals('avatar.png', $user2->avatar->file_name);
|
||||
}
|
||||
|
||||
public function testDeleteFlagDestroyRelationship()
|
||||
{
|
||||
Model::unguard();
|
||||
$user = User::create(['name' => 'Stevie', 'email' => 'stevie@example.com']);
|
||||
Model::reguard();
|
||||
|
||||
$this->assertNull($user->avatar);
|
||||
$user->avatar()->create(['data' => base_path() . '/modules/system/tests/fixtures/plugins/database/tester/assets/images/avatar.png']);
|
||||
$user->reloadRelations();
|
||||
$this->assertNotNull($user->avatar);
|
||||
|
||||
$avatar = $user->avatar;
|
||||
$avatarId = $avatar->id;
|
||||
|
||||
$user->avatar()->remove($avatar);
|
||||
$this->assertNull(FileModel::find($avatarId));
|
||||
}
|
||||
|
||||
public function testDeleteFlagDeleteModel()
|
||||
{
|
||||
Model::unguard();
|
||||
$user = User::create(['name' => 'Stevie', 'email' => 'stevie@example.com']);
|
||||
Model::reguard();
|
||||
|
||||
$this->assertNull($user->avatar);
|
||||
$user->avatar()->create(['data' => base_path() . '/modules/system/tests/fixtures/plugins/database/tester/assets/images/avatar.png']);
|
||||
$user->reloadRelations();
|
||||
$this->assertNotNull($user->avatar);
|
||||
|
||||
$avatarId = $user->avatar->id;
|
||||
$user->delete();
|
||||
$this->assertNull(FileModel::find($avatarId));
|
||||
}
|
||||
|
||||
public function testDeleteFlagSoftDeleteModel()
|
||||
{
|
||||
Model::unguard();
|
||||
$user = SoftDeleteUser::create(['name' => 'Stevie', 'email' => 'stevie@example.com']);
|
||||
Model::reguard();
|
||||
|
||||
$user->avatar()->create(['data' => base_path() . '/modules/system/tests/fixtures/plugins/database/tester/assets/images/avatar.png']);
|
||||
$this->assertNotNull($user->avatar);
|
||||
|
||||
$avatarId = $user->avatar->id;
|
||||
$user->delete();
|
||||
$this->assertNotNull(FileModel::find($avatarId));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user