cubetools/cube-common-develop
Shared development utilities and common code used across CUBE Tools projects. Install via Composer in your dev dependencies to reuse helpers and standardize tooling while building and maintaining CUBE Tools packages.
Installation:
composer require --dev cubetools/cube-common-develop
Ensure your project uses PHP 7.2+ and Symfony 4.3+ (due to compatibility updates in WebTestBase).
First Use Case:
check-commit-cube.sh to validate commits for:
.format())SmoketestPageLoadingBase for Selenium-like tests:
use CubeTools\CommonDevelop\Test\SmoketestPageLoadingBase;
class MyTest extends SmoketestPageLoadingBase {
protected function setUp(): void {
$this->loadPage('/dashboard');
}
}
Key Files:
vendor/bin/check-commit-cube: CLI tool for commit validation.src/Test/SmoketestPageLoadingBase.php: Base for integration tests.SmoketestPageLoadingBase for UI tests with built-in failure tracebacks:
$this->assertPageLoaded()
->assertElementPresent('css', '.dashboard-header');
SymfonyLoadableTest to verify all routes are accessible:
$this->assertRouteLoaded('/admin', 200);
Pre-commit Hooks:
Integrate check-commit-cube.sh into Git hooks (e.g., .git/hooks/pre-commit):
#!/bin/bash
vendor/bin/check-commit-cube --since HEAD~1
Twig Template Validation:
Use the check-twig-templates.sh script (beta) to enforce:
.format() filters.service.yaml to support tagged services:
services:
App\Service\MyService:
tags: ['my.tag']
Access via:
$container->get('my.tag')->getIterator();
- name: Run CUBE Checks
run: vendor/bin/check-commit-cube --since ${{ github.event.pull_request.base.sha }}
Symfony 4.3+ Requirement:
WebTestBase compatibility. Update Symfony if tests fail:
composer require symfony/*:^4.3
XLIFF File Handling:
check-commit-cube may fail if .xliff files are out of order. Use the reorder-xliff.sh script:
vendor/bin/reorder-xliff.sh src/Resources/translations/
Pre-commit Hooks:
check-commit-cube.sh has executable permissions:
chmod +x vendor/bin/check-commit-cube
PHPUnit 7+:
phpunit.xml config matches:
<phpunit bootstrap="vendor/autoload.php">
<extensions>
<extension class="CubeTools\CommonDevelop\Test\PHPUnit\Extensions\SmoketestExtension"/>
</extensions>
</phpunit>
Test Failures:
SmoketestPageLoadingBase by setting:
$this->setVerbose(true);
failureMessage for tracebacks.Service Container Issues:
service.yaml tags with:
vendor/bin/check-commit-cube --container
Custom Checks:
check-commit-cube.sh by adding new rules in src/Check/Rule/.Test Extensions:
SmoketestPageLoadingBase methods (e.g., assertPageLoaded()) for project-specific assertions.PHPStan Integration:
phpstan.neon to include CubeTools’ rules:
includes:
- vendor/cubetools/cube-common-develop/phpstan.neon
How can I help you explore Laravel packages today?