Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ on:
jobs:
cs:
name: 'Check coding style'
runs-on: latest
runs-on: ubuntu-latest

steps:
- name: 'Checkout current revision'
Expand Down Expand Up @@ -48,7 +48,7 @@ jobs:

unit:
name: 'Run unit tests'
runs-on: latest
runs-on: ubuntu-latest

strategy:
fail-fast: false
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ A Vite plugin and CakePHP helper that connect a Vite build to a CakePHP applicat

## Requirements

| Dependency | Version |
|------------|---------|
| PHP | ≥ 8.3 |
| CakePHP | ^4.5 |
| Vite | ^6.0 |
| Dependency | Version |
|------------|-----------------|
| PHP | ≥ 8.3 |
| CakePHP | ^4.5 || ^5.0 |
| Vite | ^6.0 |

## Installation

Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
"require": {
"php": ">=8.3",
"ext-json": "*",
"cakephp/cakephp": "^4.5"
"cakephp/cakephp": "^4.5 || ^5.0"
},
"require-dev": {
"phpunit/phpunit": "^8.5 || ^9.3",
"cakephp/cakephp-codesniffer": "~4.2.0"
"phpunit/phpunit": "^10.5.5 || ^11.1.3 || ^12.1",
"cakephp/cakephp-codesniffer": "^4.7"
},
"autoload": {
"psr-4": {
Expand Down
11 changes: 5 additions & 6 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
>
<php>
<ini name="memory_limit" value="-1"/>
<ini name="apc.enable_cli" value="1"/>
</php>

<!-- Add any additional test suites you want to run here -->
Expand All @@ -19,12 +18,12 @@

<!-- Setup fixture extension -->
<extensions>
<extension class="Cake\TestSuite\Fixture\PHPUnitExtension" />
<bootstrap class="Cake\TestSuite\Fixture\Extension\PHPUnitExtension"/>
</extensions>

<filter>
<whitelist>
<source>
<include>
<directory suffix=".php">src/</directory>
</whitelist>
</filter>
</include>
</source>
</phpunit>
5 changes: 3 additions & 2 deletions src/View/Helper/RnaHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
namespace Chialab\Vite\View\Helper;

use Cake\View\Helper;
use function Cake\Core\pluginSplit;

/**
* Rna compatible helper
Expand All @@ -16,12 +17,12 @@ class RnaHelper extends Helper
/**
* @inheritDoc
*/
public $helpers = ['Html', 'Vite'];
public array $helpers = ['Html', 'Vite'];

/**
* @inheritDoc
*/
protected $_defaultConfig = [
protected array $_defaultConfig = [
'buildPath' => WWW_ROOT . 'build',
'entrypointFile' => 'entrypoints.json',
];
Expand Down
4 changes: 2 additions & 2 deletions src/View/Helper/ViteHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ class ViteHelper extends Helper
/**
* @var array<int, string>
*/
protected $helpers = ['Html'];
protected array $helpers = ['Html'];

/**
* @var array<string, mixed>
*/
protected $_defaultConfig = [
protected array $_defaultConfig = [
// Filesystem path to the build directory. Defaults to WWW_ROOT . 'dist'.
'buildPath' => null,
// Public base prepended to the manifest paths. A leading "/" makes
Expand Down
15 changes: 15 additions & 0 deletions tests/TestCase/View/Helper/ViteHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

namespace Chialab\Vite\Test\TestCase\View\Helper;

use Cake\Core\Configure;
use Cake\TestSuite\TestCase;
use Cake\View\View;
use Chialab\Vite\View\Helper\ViteHelper;
Expand Down Expand Up @@ -42,4 +43,18 @@ protected function tearDown(): void

parent::tearDown();
}

/**
* Test that no tags are emitted when the manifest is missing.
*
* @return void
*/
public function testMissingManifest(): void
{
Configure::write('debug', false);
$this->Vite->setConfig(['buildPath' => TMP . 'missing-build'], null, false);

static::assertSame('', $this->Vite->css('app'));
static::assertSame('', $this->Vite->js('app'));
}
}
15 changes: 0 additions & 15 deletions tests/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,3 @@

return;
}

/**
* Load schema from a SQL dump file.
*
* If your plugin does not use database fixtures you can
* safely delete this.
*
* If you want to support multiple databases, consider
* using migrations to provide schema for your plugin,
* and using \Migrations\TestSuite\Migrator to load schema.
*/
use Cake\TestSuite\Fixture\SchemaLoader;

// Load a schema dump file.
(new SchemaLoader())->loadSqlFiles('tests/schema.sql', 'test');
Loading