Commit a53053c
Refactor Test Structure: Add PHPUnit Tests for Interfaces with Strong Typing and Mocks (#9)
* add data structure contracts and tests
* feat: Add and configure PHP quality and testing libraries
- Added `friendsofphp/php-cs-fixer` for code style fixing.
- Added `nunomaduro/phpinsights` for code quality and insights.
- Updated `phpunit/phpunit` to version 10.5 for unit testing.
- Added `squizlabs/php_codesniffer` for code style checking.
- Added `mockery/mockery` for mocking objects in unit tests.
- Added `enlightn/security-checker` for checking security vulnerabilities in dependencies.
Configured these libraries to ensure code quality, consistency, and security.
### Changes Introduced
1. **Code Style Fixing**:
- Added `friendsofphp/php-cs-fixer` (^3.58) to automatically fix PHP code to follow defined coding standards.
2. **Code Quality Insights**:
- Added `nunomaduro/phpinsights` (^2.11) to provide code quality and performance insights.
3. **Unit Testing**:
- Updated `phpunit/phpunit` to version ^10.5 to ensure robust and comprehensive testing of the codebase.
4. **Code Style Checking**:
- Added `squizlabs/php_codesniffer` (^3.10) to detect violations of defined coding standards.
5. **Mocking in Unit Tests**:
- Added `mockery/mockery` (^1.6) to provide an expressive and flexible API for mocking objects in unit tests.
6. **Security Vulnerability Checking**:
- Added `enlightn/security-checker` (^2.0) to scan for known security vulnerabilities in project dependencies.
### Usage
- **Code Style Fixing**:
```sh
vendor/bin/php-cs-fixer fix
```
- **Code Quality Insights**:
```sh
vendor/bin/phpinsights
```
- **Unit Testing**:
```sh
vendor/bin/phpunit
```
- **Code Style Checking**:
```sh
vendor/bin/phpcs
```
- **Mocking in Unit Tests**:
- Use Mockery within your PHPUnit tests to create mocks and set expectations.
- **Security Vulnerability Checking**:
```sh
vendor/bin/security-checker security:check
```
### Benefits
- Ensures consistent code style across the project.
- Provides actionable insights to improve code quality.
- Enhances testing capabilities with updated PHPUnit and Mockery.
- Ensures project dependencies are free from known security vulnerabilities.
### Notes
- Ensure that the required binaries are executable in your environment.
- Integrate these tools into your CI/CD pipeline for automated checks.
* resolve style PSR
* add Translate README to Brazilian Portuguese
* update ci
* Update composer.json to exclude unnecessary files and directories for package distribution
* adjust lock composer
* adjust lock composer
* adjust .env.example
* update .env.example
* Add .phpcs-cache to .gitignore and remove from version control
* update url repository in composer file
* add git attributed file
* remove file exclud reference
* Adjust settings for composer
* normalize the semantic syntax of methods and interface names
* Refactor test structure: Add PHPUnit tests for interfaces with strong typing and mocks
- Add tests for Comparable interface
- Add tests for Countable interface
- Add tests for Indexable interface
- Add tests for Iterator interface
- Add tests for Sortable interface
- Add tests for Collection interface
- Add tests for Serializable interface
- Add tests for Heap interface
- Add tests for IterableCollection interface
- Add tests for Map interface
- Add tests for Queue interface
- Add tests for Stack interface
- Add tests for Tree interface
Organize test files into respective directories for Behavioral, DataStructure, Structural, and Structure
---------
Co-authored-by: Walmir Silva <walmir.silva@growthdev.com.br>1 parent ee6f13e commit a53053c
File tree
29 files changed
+714
-452
lines changed- src/DataStructure
- Behavioral
- Structural
- tests/DataStructure
- Behavioral
- Structural
29 files changed
+714
-452
lines changedSome generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
Lines changed: 5 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
17 | | - | |
| 18 | + | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
22 | | - | |
| 23 | + | |
23 | 24 | | |
24 | | - | |
| 25 | + | |
25 | 26 | | |
0 commit comments