Skip to content

Commit d019427

Browse files
committed
Add comprehensive test cases for all Vuetify theme wireframes
1 parent c84ae4e commit d019427

19 files changed

+1319
-1257
lines changed

.github/workflows/php83.yaml

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
1-
name: Build PHP 8.3
2-
3-
on:
4-
push:
5-
branches: [ main, dev ]
6-
pull_request:
7-
branches: [ main, dev ]
8-
env:
9-
OPERATING_SYS: ubuntu-latest
10-
PHP_VERSION: 8.3
11-
jobs:
12-
13-
test:
14-
name: Run Tests
15-
uses: WebFiori/workflows/.github/workflows/test-php.yaml@main
16-
with:
17-
php-version: '8.3'
18-
phpunit-config: 'tests/phpunit10.xml'
19-
20-
21-
release-prod:
22-
name: Prepare Production Release Branch / Publish Release
23-
needs: [test]
24-
uses: WebFiori/workflows/.github/workflows/release-php.yaml@main
25-
with:
26-
branch: 'main'
1+
name: Build PHP 8.3
2+
3+
on:
4+
push:
5+
branches: [ main, dev ]
6+
pull_request:
7+
branches: [ main, dev ]
8+
env:
9+
OPERATING_SYS: ubuntu-latest
10+
PHP_VERSION: 8.3
11+
jobs:
12+
13+
test:
14+
name: Run Tests
15+
uses: WebFiori/workflows/.github/workflows/test-php.yaml@main
16+
with:
17+
php-version: '8.3'
18+
phpunit-config: 'tests/phpunit10.xml'
19+
20+
21+
release-prod:
22+
name: Prepare Production Release Branch / Publish Release
23+
needs: [test]
24+
uses: WebFiori/workflows/.github/workflows/release-php.yaml@main
25+
with:
26+
branch: 'main'

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
/nbproject
2-
/vendor
1+
/nbproject
2+
/vendor
33
.php_cs.cache
44
php-cs-fixer-v2.phar
55
*.Identifier

LICENSE

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

README.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
# Vuetify Core
2-
3-
This repo holds a base theme which holds basic structure for building Vuetify based themes.
4-
5-
## Installation
6-
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.
7-
8-
## Classes
9-
10-
### [`VuetifyThemeCore`](https://github.com/WebFiori/vuetifyCore/blob/main/themes/vuetifyCore/VuetifyThemeCore.php)
11-
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.
12-
13-
### [`VuetifyWebPage`](https://github.com/WebFiori/vuetifyCore/blob/main/themes/vuetifyCore/VuetifyWebPage.php)
14-
This class extends the class `WebPage`. It has utility methods which helps in creating pages which is based on Vuetify much easier task.
15-
16-
### [`CreateVuetifyThemeCommand`](https://github.com/WebFiori/vuetifyCore/blob/main/themes/vuetifyCore/cli/CreateVuetifyThemeCommand.php)
17-
A CLI command that can be registered to create Vuetify theme wireframes. This command can be registered in the class `InitCLICommands` of your application.
1+
# Vuetify Core
2+
3+
This repo holds a base theme which holds basic structure for building Vuetify based themes.
4+
5+
## Installation
6+
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.
7+
8+
## Classes
9+
10+
### [`VuetifyThemeCore`](https://github.com/WebFiori/vuetifyCore/blob/main/themes/vuetifyCore/VuetifyThemeCore.php)
11+
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.
12+
13+
### [`VuetifyWebPage`](https://github.com/WebFiori/vuetifyCore/blob/main/themes/vuetifyCore/VuetifyWebPage.php)
14+
This class extends the class `WebPage`. It has utility methods which helps in creating pages which is based on Vuetify much easier task.
15+
16+
### [`CreateVuetifyThemeCommand`](https://github.com/WebFiori/vuetifyCore/blob/main/themes/vuetifyCore/cli/CreateVuetifyThemeCommand.php)
17+
A CLI command that can be registered to create Vuetify theme wireframes. This command can be registered in the class `InitCLICommands` of your application.

TEST_SUMMARY.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# VuetifyCore Test Suite Summary
2+
3+
## Overview
4+
Implemented comprehensive test cases for the VuetifyCore library following the WebFiori framework testing patterns.
5+
6+
## Test Files Created
7+
8+
### 1. CreateVuetifyThemeCommandTest.php
9+
- Tests the CLI command for creating Vuetify themes
10+
- Validates command name, description, and arguments
11+
- Tests command instantiation and basic properties
12+
13+
### 2. VuetifyThemeClassWriterTest.php
14+
- Tests the theme class writer with different wireframes:
15+
- Base wireframe
16+
- Extended Toolbar wireframe
17+
- System Bar wireframe
18+
- Inbox wireframe
19+
- Side Navigation wireframe
20+
- Validates class name and namespace handling
21+
22+
### 3. SectionWritersTest.php
23+
- Tests all section writer classes:
24+
- HeaderSectionWriter
25+
- FooterSectionWriter
26+
- SideSectionWriter
27+
- HeadSectionWriter
28+
- SysBarWriter
29+
- Validates proper instantiation with VuetifyThemeClassWriter
30+
31+
### 4. VuetifyWebPageTest.php
32+
- Tests JSON handling functionality
33+
- Tests Vuetify item structure creation
34+
- Validates data transformation methods
35+
36+
### 5. VuetifyThemeCoreTest.php
37+
- Tests core theme functionality
38+
- Validates version format and constants
39+
- Tests app ID validation logic
40+
41+
### 6. IntegrationTest.php
42+
- Tests integration between different components
43+
- Validates command and writer interaction
44+
- Tests JSON structure for Vuetify components
45+
- Tests all wireframe types
46+
47+
## Test Results
48+
- **Total Tests**: 22
49+
- **Total Assertions**: 61
50+
- **Status**: All tests passing ✅
51+
- **Coverage**: Clover XML report generated
52+
53+
## Fixed Issues
54+
1. Fixed composer.json syntax errors
55+
2. Updated PHPUnit configuration for new directory structure
56+
3. Fixed namespace references after PascalCase refactoring
57+
4. Added proper autoloading configuration
58+
5. Corrected API calls to match WebFiori framework patterns
59+
60+
## Test Commands
61+
- `composer test` - Run all tests
62+
- `composer test10` - Run tests with PHPUnit 10 configuration
Lines changed: 82 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -1,82 +1,82 @@
1-
<?php
2-
namespace Themes\VuetifyCore\Cli;
3-
4-
use WebFiori\Cli\Command;
5-
6-
7-
/**
8-
* A command which can be used to create a Vuetify based theme template.
9-
*
10-
* @author Ibrahim
11-
*/
12-
class CreateVuetifyThemeCommand extends Command {
13-
/**
14-
* Creates new instance of the class.
15-
*/
16-
public function __construct() {
17-
parent::__construct('create-vuetify-theme', [
18-
], 'Creates a theme which will be based on Vuetify UI framework. The created '
19-
.'theme will be based on one of the wireframes which exist at '
20-
.'https://vuetifyjs.com/en/getting-started/wireframes .');
21-
}
22-
/**
23-
* Execute the command.
24-
*
25-
* @return int The method will always return 0.
26-
*/
27-
public function exec() : int {
28-
$wireframes = [
29-
"Base",
30-
"Extended Toolbar",
31-
"System Bar",
32-
"Inbox",
33-
"Side Navigation",
34-
];
35-
$wireframe = $this->select('Select theme wireframe:', $wireframes, 0);
36-
$classInfo = $this->getClassInfo();
37-
$classInfo['wireframe'] = $wireframe;
38-
$creator = new VuetifyThemeClassWriter($classInfo);
39-
$this->println("Creating new vuetify theme based on '$wireframe' wireframe...");
40-
$creator->writeClass();
41-
$this->println('Your theme was successfully created.');
42-
43-
return 0;
44-
}
45-
46-
/**
47-
* Prompts the user to enter class information such as it is name.
48-
*
49-
* This method is useful in case we would like to create a class.
50-
*
51-
* @return array The method will return an array that contains 3 indices:
52-
* <ul>
53-
* <li><b>name</b>: The name of the class.</li>
54-
* <li><b>namespace</b>: The namespace of the class. It will be empty string if no
55-
* namespace is entered.</li>
56-
* <li><b>path</b>: The location at which the class will be created.</li>
57-
* </ul>
58-
*
59-
* @since 1.0
60-
*/
61-
public function getClassInfo() {
62-
$classExist = true;
63-
64-
do {
65-
$className = $this->readClassName('Enter a name for the new class:', 'Theme');
66-
$ns = $this->readNamespace('Enter namespace for the class:', 'Themes\\Vuetify');
67-
$classWithNs = $ns.'\\'.$className;
68-
$classExist = class_exists($classWithNs);
69-
70-
if ($classExist) {
71-
$this->error('A class in the given namespace which has the given name was found.');
72-
}
73-
} while ($classExist);
74-
$path = ROOT_PATH.DS.trim(trim(str_replace('\\', DS, str_replace('/', DS, $ns)),'/'),'\\');
75-
76-
return [
77-
'name' => $className,
78-
'namespace' => $ns,
79-
'path' => $path
80-
];
81-
}
82-
}
1+
<?php
2+
namespace Themes\VuetifyCore\Cli;
3+
4+
use WebFiori\Cli\Command;
5+
6+
7+
/**
8+
* A command which can be used to create a Vuetify based theme template.
9+
*
10+
* @author Ibrahim
11+
*/
12+
class CreateVuetifyThemeCommand extends Command {
13+
/**
14+
* Creates new instance of the class.
15+
*/
16+
public function __construct() {
17+
parent::__construct('create-vuetify-theme', [
18+
], 'Creates a theme which will be based on Vuetify UI framework. The created '
19+
.'theme will be based on one of the wireframes which exist at '
20+
.'https://vuetifyjs.com/en/getting-started/wireframes .');
21+
}
22+
/**
23+
* Execute the command.
24+
*
25+
* @return int The method will always return 0.
26+
*/
27+
public function exec() : int {
28+
$wireframes = [
29+
"Base",
30+
"Extended Toolbar",
31+
"System Bar",
32+
"Inbox",
33+
"Side Navigation",
34+
];
35+
$wireframe = $this->select('Select theme wireframe:', $wireframes, 0);
36+
$classInfo = $this->getClassInfo();
37+
$classInfo['wireframe'] = $wireframe;
38+
$creator = new VuetifyThemeClassWriter($classInfo);
39+
$this->println("Creating new vuetify theme based on '$wireframe' wireframe...");
40+
$creator->writeClass();
41+
$this->println('Your theme was successfully created.');
42+
43+
return 0;
44+
}
45+
46+
/**
47+
* Prompts the user to enter class information such as it is name.
48+
*
49+
* This method is useful in case we would like to create a class.
50+
*
51+
* @return array The method will return an array that contains 3 indices:
52+
* <ul>
53+
* <li><b>name</b>: The name of the class.</li>
54+
* <li><b>namespace</b>: The namespace of the class. It will be empty string if no
55+
* namespace is entered.</li>
56+
* <li><b>path</b>: The location at which the class will be created.</li>
57+
* </ul>
58+
*
59+
* @since 1.0
60+
*/
61+
public function getClassInfo() {
62+
$classExist = true;
63+
64+
do {
65+
$className = $this->readClassName('Enter a name for the new class:', 'Theme');
66+
$ns = $this->readNamespace('Enter namespace for the class:', 'Themes\\Vuetify');
67+
$classWithNs = $ns.'\\'.$className;
68+
$classExist = class_exists($classWithNs);
69+
70+
if ($classExist) {
71+
$this->error('A class in the given namespace which has the given name was found.');
72+
}
73+
} while ($classExist);
74+
$path = ROOT_PATH.DS.trim(trim(str_replace('\\', DS, str_replace('/', DS, $ns)),'/'),'\\');
75+
76+
return [
77+
'name' => $className,
78+
'namespace' => $ns,
79+
'path' => $path
80+
];
81+
}
82+
}

0 commit comments

Comments
 (0)