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
26 changes: 26 additions & 0 deletions .github/workflows/php83.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Build PHP 8.3

on:
push:
branches: [ main, dev ]
pull_request:
branches: [ main, dev ]
env:
OPERATING_SYS: ubuntu-latest
PHP_VERSION: 8.3
jobs:

test:
name: Run Tests
uses: WebFiori/workflows/.github/workflows/test-php.yaml@main
with:
php-version: '8.3'
phpunit-config: 'tests/phpunit10.xml'


release-prod:
name: Prepare Production Release Branch / Publish Release
needs: [test]
uses: WebFiori/workflows/.github/workflows/release-php.yaml@main
with:
branch: 'main'
8 changes: 6 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
/nbproject
/vendor
/nbproject
/vendor
.php_cs.cache
php-cs-fixer-v2.phar
*.Identifier
/tests/.phpunit.cache
/.vscode
tests/clover.xml
42 changes: 21 additions & 21 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
MIT License

Copyright (c) 2021 WebFiori Framework

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
MIT License
Copyright (c) 2021 WebFiori Framework
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
34 changes: 17 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# Vuetify Core

This repo holds a base theme which holds basic structure for building Vuetify based themes.

## Installation
First of all, you need to have WebFiori framework installed. After that, include the following in your `require` section of your `composer.json` file: `webfiori/vuetifyCore`. Then run the command `php composer "install" "--no-dev"` to install your dependencies.

## Classes

### [`VuetifyThemeCore`](https://github.com/WebFiori/vuetifyCore/blob/main/themes/vuetifyCore/VuetifyThemeCore.php)
This is the theme class. It acts as the core of any Vuetify based theme. The developer must extend this class in order to create his own Vuetify based themes.

### [`VuetifyWebPage`](https://github.com/WebFiori/vuetifyCore/blob/main/themes/vuetifyCore/VuetifyWebPage.php)
This class extends the class `WebPage`. It has utility methods which helps in creating pages which is based on Vuetify much easier task.

### [`CreateVuetifyThemeCommand`](https://github.com/WebFiori/vuetifyCore/blob/main/themes/vuetifyCore/cli/CreateVuetifyThemeCommand.php)
A CLI command that can be registered to create Vuetify theme wireframes. This command can be registered in the class `InitCLICommands` of your application.
# Vuetify Core
This repo holds a base theme which holds basic structure for building Vuetify based themes.
## Installation
First of all, you need to have WebFiori framework installed. After that, include the following in your `require` section of your `composer.json` file: `webfiori/vuetifyCore`. Then run the command `php composer "install" "--no-dev"` to install your dependencies.
## Classes
### [`VuetifyThemeCore`](https://github.com/WebFiori/vuetifyCore/blob/main/themes/vuetifyCore/VuetifyThemeCore.php)
This is the theme class. It acts as the core of any Vuetify based theme. The developer must extend this class in order to create his own Vuetify based themes.
### [`VuetifyWebPage`](https://github.com/WebFiori/vuetifyCore/blob/main/themes/vuetifyCore/VuetifyWebPage.php)
This class extends the class `WebPage`. It has utility methods which helps in creating pages which is based on Vuetify much easier task.
### [`CreateVuetifyThemeCommand`](https://github.com/WebFiori/vuetifyCore/blob/main/themes/vuetifyCore/cli/CreateVuetifyThemeCommand.php)
A CLI command that can be registered to create Vuetify theme wireframes. This command can be registered in the class `InitCLICommands` of your application.
62 changes: 62 additions & 0 deletions TEST_SUMMARY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# VuetifyCore Test Suite Summary

## Overview
Implemented comprehensive test cases for the VuetifyCore library following the WebFiori framework testing patterns.

## Test Files Created

### 1. CreateVuetifyThemeCommandTest.php
- Tests the CLI command for creating Vuetify themes
- Validates command name, description, and arguments
- Tests command instantiation and basic properties

### 2. VuetifyThemeClassWriterTest.php
- Tests the theme class writer with different wireframes:
- Base wireframe
- Extended Toolbar wireframe
- System Bar wireframe
- Inbox wireframe
- Side Navigation wireframe
- Validates class name and namespace handling

### 3. SectionWritersTest.php
- Tests all section writer classes:
- HeaderSectionWriter
- FooterSectionWriter
- SideSectionWriter
- HeadSectionWriter
- SysBarWriter
- Validates proper instantiation with VuetifyThemeClassWriter

### 4. VuetifyWebPageTest.php
- Tests JSON handling functionality
- Tests Vuetify item structure creation
- Validates data transformation methods

### 5. VuetifyThemeCoreTest.php
- Tests core theme functionality
- Validates version format and constants
- Tests app ID validation logic

### 6. IntegrationTest.php
- Tests integration between different components
- Validates command and writer interaction
- Tests JSON structure for Vuetify components
- Tests all wireframe types

## Test Results
- **Total Tests**: 22
- **Total Assertions**: 61
- **Status**: All tests passing ✅
- **Coverage**: Clover XML report generated

## Fixed Issues
1. Fixed composer.json syntax errors
2. Updated PHPUnit configuration for new directory structure
3. Fixed namespace references after PascalCase refactoring
4. Added proper autoloading configuration
5. Corrected API calls to match WebFiori framework patterns

## Test Commands
- `composer test` - Run all tests
- `composer test10` - Run tests with PHPUnit 10 configuration
Original file line number Diff line number Diff line change
@@ -1,79 +1,82 @@
<?php
namespace themes\vuetifyCore\cli;

use webfiori\cli\CLICommand;


/**
* A command which can be used to create a Vuetify based theme template.
*
* @author Ibrahim
*/
class CreateVuetifyThemeCommand extends CLICommand {
/**
* Creates new instance of the class.
*/
public function __construct() {
parent::__construct('create-vuetify-theme', [
], 'Creates a theme which will be based on Vuetify UI framework. The created '
.'theme will be based on one of the wireframes which exist at '
.'https://vuetifyjs.com/en/getting-started/wireframes .');
}
/**
* Execute the command.
*
* @return int The method will always return 0.
*/
public function exec() : int {
$wireframes = [
"Base","Extended Toolbar", "System Bar",
"Inbox", "Side Navigation",
];
$wireframe = $this->select('Select theme wireframe:', $wireframes, 0);
$classInfo = $this->getClassInfo();
$classInfo['wireframe'] = $wireframe;
$creator = new VuetifyThemeClassWriter($classInfo);
$this->println("Creating new vuetify theme based on '$wireframe' wireframe...");
$creator->writeClass();
$this->println('Your theme was successfully created.');

return 0;
}

/**
* Prompts the user to enter class information such as it is name.
*
* This method is useful in case we would like to create a class.
*
* @return array The method will return an array that contains 3 indices:
* <ul>
* <li><b>name</b>: The name of the class.</li>
* <li><b>namespace</b>: The namespace of the class. It will be empty string if no
* namespace is entered.</li>
* <li><b>path</b>: The location at which the class will be created.</li>
* </ul>
*
* @since 1.0
*/
public function getClassInfo() {
$classExist = true;

do {
$className = $this->readClassName('Enter a name for the new class:', 'Theme');
$ns = $this->readNamespace('Enter namespace for the class:', 'themes\\vuetify');
$classWithNs = $ns.'\\'.$className;
$classExist = class_exists($classWithNs);

if ($classExist) {
$this->error('A class in the given namespace which has the given name was found.');
}
} while ($classExist);
$path = ROOT_DIR.DS.trim(trim(str_replace('\\', DS, str_replace('/', DS, $ns)),'/'),'\\');

return [
'name' => $className,
'namespace' => $ns,
'path' => $path
];
}
}
<?php
namespace Themes\VuetifyCore\Cli;

use WebFiori\Cli\Command;


/**
* A command which can be used to create a Vuetify based theme template.
*
* @author Ibrahim
*/
class CreateVuetifyThemeCommand extends Command {
/**
* Creates new instance of the class.
*/
public function __construct() {
parent::__construct('create-vuetify-theme', [
], 'Creates a theme which will be based on Vuetify UI framework. The created '
.'theme will be based on one of the wireframes which exist at '
.'https://vuetifyjs.com/en/getting-started/wireframes .');
}
/**
* Execute the command.
*
* @return int The method will always return 0.
*/
public function exec() : int {
$wireframes = [
"Base",
"Extended Toolbar",
"System Bar",
"Inbox",
"Side Navigation",
];
$wireframe = $this->select('Select theme wireframe:', $wireframes, 0);
$classInfo = $this->getClassInfo();
$classInfo['wireframe'] = $wireframe;
$creator = new VuetifyThemeClassWriter($classInfo);
$this->println("Creating new vuetify theme based on '$wireframe' wireframe...");
$creator->writeClass();
$this->println('Your theme was successfully created.');

return 0;
}

/**
* Prompts the user to enter class information such as it is name.
*
* This method is useful in case we would like to create a class.
*
* @return array The method will return an array that contains 3 indices:
* <ul>
* <li><b>name</b>: The name of the class.</li>
* <li><b>namespace</b>: The namespace of the class. It will be empty string if no
* namespace is entered.</li>
* <li><b>path</b>: The location at which the class will be created.</li>
* </ul>
*
* @since 1.0
*/
public function getClassInfo() {
$classExist = true;

do {
$className = $this->readClassName('Enter a name for the new class:', 'Theme');
$ns = $this->readNamespace('Enter namespace for the class:', 'Themes\\Vuetify');
$classWithNs = $ns.'\\'.$className;
$classExist = class_exists($classWithNs);

if ($classExist) {
$this->error('A class in the given namespace which has the given name was found.');
}
} while ($classExist);
$path = ROOT_PATH.DS.trim(trim(str_replace('\\', DS, str_replace('/', DS, $ns)),'/'),'\\');

return [
'name' => $className,
'namespace' => $ns,
'path' => $path
];
}
}
Loading