Skip to content

Commit 6f250f3

Browse files
committed
add testing
1 parent b06ce59 commit 6f250f3

File tree

18 files changed

+687
-29
lines changed

18 files changed

+687
-29
lines changed

.editorconfig

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
indent_size = 4
7+
indent_style = space
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true
10+
11+
[*.md]
12+
trim_trailing_whitespace = false
13+
14+
[*.{yml,yaml}]
15+
indent_size = 2
16+
17+
[*.json]
18+
indent_size = 2
19+
20+
[*.blade.php]
21+
indent_size = 2

.github/workflows/pint.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Code Style
2+
3+
on:
4+
push:
5+
branches: [ main, develop ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
pint:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Setup PHP
17+
uses: shivammathur/setup-php@v2
18+
with:
19+
php-version: 8.3
20+
extensions: mbstring, intl
21+
22+
- name: Install dependencies
23+
run: composer install --prefer-dist --no-interaction --no-progress
24+
25+
- name: Run Laravel Pint
26+
run: vendor/bin/pint --test

.github/workflows/tests.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
branches: [ main, develop ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
php: [8.1, 8.2, 8.3]
16+
laravel: [10.*, 11.*, 12.*]
17+
include:
18+
- laravel: 10.*
19+
testbench: 8.*
20+
- laravel: 11.*
21+
testbench: 9.*
22+
- laravel: 12.*
23+
testbench: 10.*
24+
exclude:
25+
- php: 8.1
26+
laravel: 11.*
27+
- php: 8.1
28+
laravel: 12.*
29+
30+
name: PHP ${{ matrix.php }} - Laravel ${{ matrix.laravel }}
31+
32+
steps:
33+
- uses: actions/checkout@v4
34+
35+
- name: Setup PHP
36+
uses: shivammathur/setup-php@v2
37+
with:
38+
php-version: ${{ matrix.php }}
39+
extensions: mbstring, intl
40+
coverage: xdebug
41+
42+
- name: Validate composer.json
43+
run: composer validate --strict
44+
45+
- name: Cache Composer packages
46+
id: composer-cache
47+
uses: actions/cache@v4
48+
with:
49+
path: vendor
50+
key: ${{ runner.os }}-php-${{ matrix.php }}-${{ matrix.laravel }}-${{ hashFiles('**/composer.lock') }}
51+
restore-keys: |
52+
${{ runner.os }}-php-
53+
54+
- name: Install dependencies
55+
run: |
56+
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
57+
composer update --prefer-dist --no-interaction --no-progress
58+
59+
- name: Run test suite
60+
run: vendor/bin/pest --coverage-text

.gitignore

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,14 @@
1-
/TODO.md
1+
/vendor/
2+
/composer.lock
3+
/.phpunit.result.cache
4+
/.php-cs-fixer.cache
5+
/.idea/
6+
/.vscode/
7+
/.env
8+
/.env.local
9+
/phpunit.xml.dist.bak
10+
/coverage/
11+
/.DS_Store
12+
/node_modules/
13+
/npm-debug.log
14+
/yarn-error.log

AGENTS.md

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ FileViewEntryPlugin is a **Filament plugin** that provides a custom Infolist ent
2626

2727
```
2828
FileViewEntryPlugin/
29-
├── src/
29+
├── src/ # Source code
3030
│ ├── FileViewEntryPlugin.php # Plugin class
3131
│ ├── FileViewEntryPluginServiceProvider.php # Service provider
3232
│ └── Infolists/
@@ -37,7 +37,20 @@ FileViewEntryPlugin/
3737
│ └── infolists/
3838
│ └── components/
3939
│ └── file-view-entry.blade.php # Blade view
40+
├── tests/ # Test suite
41+
│ ├── TestCase.php # Base test class
42+
│ └── Unit/
43+
│ └── FileViewEntryTest.php # Component tests
44+
├── .github/
45+
│ └── workflows/
46+
│ ├── tests.yml # CI test workflow
47+
│ └── pint.yml # Code style workflow
4048
├── composer.json
49+
├── phpunit.xml # PHPUnit configuration
50+
├── pint.json # Laravel Pint configuration
51+
├── CHANGELOG.md # Version history
52+
├── CONTRIBUTING.md # Contribution guidelines
53+
├── SECURITY.md # Security policy
4154
├── README.md
4255
└── AGENTS.md (this file)
4356
```
@@ -161,7 +174,25 @@ Card styling:
161174
Run tests with:
162175

163176
```bash
164-
composer test
177+
vendor/bin/pest
178+
```
179+
180+
Run tests with coverage:
181+
182+
```bash
183+
vendor/bin/pest --coverage
184+
```
185+
186+
Run code style checks with:
187+
188+
```bash
189+
vendor/bin/pint --test
190+
```
191+
192+
Fix code style issues with:
193+
194+
```bash
195+
vendor/bin/pint
165196
```
166197

167198
---

CHANGELOG.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [Unreleased]
9+
10+
### Added
11+
- Initial release of FileViewEntryPlugin
12+
- File attachment viewer for Filament Infolists
13+
- Type-specific icons for images, videos, audio, PDFs, and text files
14+
- Modal preview for supported file types
15+
- Responsive grid layout (1-6 columns)
16+
- Customizable data keys (title, path, date)
17+
- Direct download option
18+
- Dark mode support
19+
- Support for single files, arrays, and Eloquent Collections
20+
21+
## [1.0.0] - TBD
22+
23+
### Added
24+
- First stable release
25+
26+
[Unreleased]: https://github.com/gheith3/FileViewEntryPlugin/compare/v1.0.0...HEAD
27+
[1.0.0]: https://github.com/gheith3/FileViewEntryPlugin/releases/tag/v1.0.0

CONTRIBUTING.md

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# Contributing to FileViewEntryPlugin
2+
3+
Thank you for your interest in contributing to FileViewEntryPlugin! We welcome contributions from the community.
4+
5+
## Getting Started
6+
7+
1. Fork the repository on GitHub
8+
2. Clone your fork locally
9+
3. Create a new branch for your feature or bug fix
10+
4. Make your changes
11+
5. Run tests and code style checks
12+
6. Submit a pull request
13+
14+
## Development Setup
15+
16+
```bash
17+
# Clone your fork
18+
git clone https://github.com/your-username/FileViewEntryPlugin.git
19+
cd FileViewEntryPlugin
20+
21+
# Install dependencies
22+
composer install
23+
24+
# Run tests
25+
vendor/bin/pest
26+
27+
# Run tests with coverage
28+
vendor/bin/pest --coverage
29+
30+
# Run code style checks
31+
vendor/bin/pint --test
32+
33+
# Fix code style issues
34+
vendor/bin/pint
35+
```
36+
37+
## Code Style
38+
39+
This project follows the [Laravel](https://laravel.com/docs/11.x/pint) code style. Please ensure your code passes the style checks before submitting a pull request.
40+
41+
## Testing
42+
43+
- Write tests for new features
44+
- Ensure all tests pass before submitting PR
45+
- Aim for high test coverage
46+
47+
## Pull Request Process
48+
49+
1. Update the README.md with details of changes if applicable
50+
2. Update the CHANGELOG.md with your changes
51+
3. Ensure your code follows the project's code style
52+
4. Verify all tests pass
53+
5. Link any related issues in your PR description
54+
55+
## Reporting Issues
56+
57+
When reporting issues, please include:
58+
59+
- PHP version
60+
- Laravel version
61+
- Filament version
62+
- Clear description of the problem
63+
- Steps to reproduce
64+
- Expected vs actual behavior
65+
66+
## Code of Conduct
67+
68+
This project adheres to a code of conduct. By participating, you are expected to uphold this code:
69+
70+
- Be respectful and inclusive
71+
- Welcome newcomers
72+
- Focus on constructive feedback
73+
- Respect differing viewpoints
74+
75+
## License
76+
77+
By contributing, you agree that your contributions will be licensed under the MIT License.

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,10 +159,10 @@ The MIT License (MIT). Please see [License File](LICENSE.md) for more informatio
159159

160160
## Credits
161161

162-
- Created by [Your Name](https://github.com/yourusername)
162+
- Created by [Gheith](https://github.com/gheith3)
163163
- Inspired by the Filament community
164164

165165
## Support
166166

167-
- 🐛 [Report Issues](https://github.com/gheith3/filament-file-view-entry/issues)
168-
- 💡 [Request Features](https://github.com/gheith3/filament-file-view-entry/discussions)
167+
- 🐛 [Report Issues](https://github.com/gheith3/FileViewEntryPlugin/issues)
168+
- 💡 [Request Features](https://github.com/gheith3/FileViewEntryPlugin/discussions)

SECURITY.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Security Policy
2+
3+
## Supported Versions
4+
5+
| Version | Supported |
6+
| ------- | ------------------ |
7+
| 1.x | :white_check_mark: |
8+
9+
## Reporting a Vulnerability
10+
11+
If you discover a security vulnerability within FileViewEntryPlugin, please send an email to Gheith at alrawahi.gheith@gmail.com. All security vulnerabilities will be promptly addressed.
12+
13+
Please do not report security issues publicly via GitHub Issues.
14+
15+
## What to Expect
16+
17+
- Acknowledgment of your report within 48 hours
18+
- Regular updates on our progress
19+
- Credit for the discovery (unless you prefer to remain anonymous)
20+
- A fix released as soon as possible
21+
22+
## Security Best Practices
23+
24+
When using this plugin:
25+
26+
- Always use HTTPS in production
27+
- Keep your dependencies up to date
28+
- Use appropriate file storage permissions
29+
- Validate file uploads on the server side
30+
- Use temporary URLs with appropriate expiration times

0 commit comments

Comments
 (0)