Files
vivespos-landing/modules/system/tests/console/asset/mix/MixCompileTest.php
avives 1f72193a64
Some checks are pending
Module sub-split / Sub-split (push) Waiting to run
feat: VivesPOS landing on Winter CMS 1.2 — theme + plugin + Dockerfile
- 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
2026-08-21 19:29:00 -06:00

101 lines
4.1 KiB
PHP

<?php
namespace System\Tests\Console\Asset\Mix;
use System\Tests\Bootstrap\TestCase;
use Winter\Storm\Support\Facades\File;
class MixCompileTest extends TestCase
{
protected string $command = 'mix:compile';
public function setUp(): void
{
parent::setUp();
if (!File::exists(base_path('node_modules'))) {
$this->markTestSkipped('This test requires node_modules to be installed');
}
if (!File::exists(base_path('node_modules/.bin/mix'))) {
$this->markTestSkipped('This test requires the mix package to be installed');
}
}
public function testCompileMultiple()
{
$this->artisan($this->command, [
'--manifest' => 'modules/system/tests/fixtures/npm/package-ac.json',
'--silent' => true
])->assertExitCode(0);
$this->assertFileExists(base_path('modules/system/tests/fixtures/plugins/mix/testa/assets/dist/app.js'));
$this->assertFileExists(base_path('modules/system/tests/fixtures/plugins/mix/testc/assets/dist/app.js'));
}
public function testCompileMultipleWithErrors()
{
$this->artisan($this->command, [
'--manifest' => 'modules/system/tests/fixtures/npm/package-abc.json',
'--disable-tty' => true
])
->expectsOutputToContain('Error: Can\'t resolve \'some-missing-package\'')
->assertExitCode(1);
$this->assertFileExists(base_path('modules/system/tests/fixtures/plugins/mix/testa/assets/dist/app.js'));
$this->assertFileExists(base_path('modules/system/tests/fixtures/plugins/mix/testb/assets/dist/app.js'));
$this->assertFileExists(base_path('modules/system/tests/fixtures/plugins/mix/testc/assets/dist/app.js'));
}
public function testCompileTarget()
{
$this->artisan($this->command, [
'--manifest' => 'modules/system/tests/fixtures/npm/package-abc.json',
'--package' => 'mix.testa',
'--silent' => true
])->assertExitCode(0);
$this->assertFileExists(base_path('modules/system/tests/fixtures/plugins/mix/testa/assets/dist/app.js'));
$this->assertFileNotExists(base_path('modules/system/tests/fixtures/plugins/mix/testb/assets/dist/app.js'));
$this->assertFileNotExists(base_path('modules/system/tests/fixtures/plugins/mix/testc/assets/dist/app.js'));
}
public function testCompileTargetWithError()
{
$this->artisan($this->command, [
'--manifest' => 'modules/system/tests/fixtures/npm/package-abc.json',
'--package' => 'mix.testb',
'--disable-tty' => true
])
->expectsOutputToContain('Error: Can\'t resolve \'some-missing-package\'')
->assertExitCode(1);
$this->assertFileNotExists(base_path('modules/system/tests/fixtures/plugins/mix/testa/assets/dist/app.js'));
$this->assertFileNotExists(base_path('modules/system/tests/fixtures/plugins/mix/testc/assets/dist/app.js'));
$this->assertFileExists(base_path('modules/system/tests/fixtures/plugins/mix/testb/assets/dist/app.js'));
}
public function testCompileTargetStopOnError()
{
$this->artisan($this->command, [
'--manifest' => 'modules/system/tests/fixtures/npm/package-abc.json',
'--stop-on-error' => true,
'--disable-tty' => true
])
->expectsOutputToContain('Error: Can\'t resolve \'some-missing-package\'')
->assertExitCode(1);
$this->assertFileExists(base_path('modules/system/tests/fixtures/plugins/mix/testa/assets/dist/app.js'));
$this->assertFileExists(base_path('modules/system/tests/fixtures/plugins/mix/testb/assets/dist/app.js'));
$this->assertFileNotExists(base_path('modules/system/tests/fixtures/plugins/mix/testc/assets/dist/app.js'));
}
public function tearDown(): void
{
File::deleteDirectory('modules/system/tests/fixtures/plugins/mix/testa/assets/dist');
File::deleteDirectory('modules/system/tests/fixtures/plugins/mix/testb/assets/dist');
File::deleteDirectory('modules/system/tests/fixtures/plugins/mix/testc/assets/dist');
parent::tearDown();
}
}