-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from HRADigital/feature/v2
Version 2.0
- Loading branch information
Showing
183 changed files
with
10,903 additions
and
7,139 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
# CircleCI Continuous Integration | ||
|
||
PHP-Datatypes uses CircleCI for code testing and coverage. | ||
|
||
The project currently supports version `7.4`, `8.0` & `8.1` of PHP. | ||
|
||
## Installation | ||
|
||
In order to validate CircleCI configuration, you'll need to install locally `circleci` cli utility: | ||
|
||
```bash | ||
sudo snap install circleci | ||
``` | ||
|
||
After installation of `circleci` utility, you can assess Coding Standards and Testing in multiple supported PHP versions. | ||
|
||
In order to test CircleCI configiuration file, you can run `circleci config validate`. | ||
|
||
## Quick links | ||
|
||
- [CodeDov](https://app.codecov.io/gh/HRADigital/php-datatypes) | ||
- [Codacy](https://app.codacy.com/gh/HRADigital/php-datatypes/dashboard) | ||
- [CircleCI](https://app.circleci.com/pipelines/github/HRADigital/php-datatypes?filter=all) | ||
|
||
## Coding Standards | ||
|
||
Run `circleci local execute --job php-cs` from the root of the project in order to test Coding Standards. | ||
|
||
Coding standards' job will also give you information about the environment and project it's running on: | ||
|
||
### PHP Version | ||
|
||
```bash | ||
PHP 7.4.26 (cli) (built: Nov 23 2021 21:06:06) ( NTS ) | ||
Copyright (c) The PHP Group | ||
Zend Engine v3.4.0, Copyright (c) Zend Technologies | ||
``` | ||
|
||
### Project's Statistics | ||
|
||
```bash | ||
------------------------------------------------------------------------------- | ||
Language files blank comment code | ||
------------------------------------------------------------------------------- | ||
PHP 108 1129 4016 4139 | ||
Markdown 27 171 0 431 | ||
YAML 1 6 0 83 | ||
JSON 1 0 0 47 | ||
------------------------------------------------------------------------------- | ||
SUM: 137 1306 4016 4700 | ||
------------------------------------------------------------------------------- | ||
``` | ||
|
||
In order to access Code Coverage reports, please go to [CodeDov](https://app.codecov.io/gh/HRADigital/php-datatypes). | ||
|
||
In order to access Code Quality reports, please go to [Codacy](https://app.codacy.com/gh/HRADigital/php-datatypes/dashboard). | ||
|
||
## Testing | ||
|
||
Run `circleci local execute --job php-74` to test `v7.4`, or replace `74` with `80` or `81`, for versions `v8.0` & `v8.1`: | ||
|
||
- `circleci local execute --job php-74` | ||
- `circleci local execute --job php-80` | ||
- `circleci local execute --job php-81` | ||
|
||
In order to access CI reports, please got to [CircleCI](https://app.circleci.com/pipelines/github/HRADigital/php-datatypes?filter=all). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,107 @@ | ||
version: 2.1 | ||
|
||
orbs: | ||
codecov: codecov/[email protected] | ||
|
||
jobs: | ||
build: | ||
php-cs: | ||
docker: | ||
- image: circleci/php:7.2 | ||
- image: cimg/php:7.4 | ||
working_directory: ~/php-datatypes | ||
steps: | ||
# GIT | ||
- checkout | ||
# SYSTEM | ||
- run: | ||
name: Install System Packages | ||
name: Update System | ||
command: sudo apt-get update | ||
- run: | ||
name: Install CLOC | ||
command: sudo apt-get -y install cloc | ||
# COMPOSER | ||
- run: | ||
name: Install Composer Dependencies | ||
command: composer install | ||
# STATISTICS | ||
name: PHP Version | ||
command: php -v | ||
- run: | ||
name: Project's Statistics | ||
command: git ls-files | xargs cloc | ||
# TESTS | ||
- run: | ||
name: Run Tests | ||
command: phpdbg -qrr vendor/bin/phpunit --coverage-clover ~/build/coverage-report | ||
name: Composer Install | ||
command: composer install | ||
- run: | ||
name: Check Coding Standards for PHPv7.4 | ||
command: | | ||
vendor/bin/phpcs --standard=PSR2 --exclude=Squiz.WhiteSpace.ControlStructureSpacing src | ||
vendor/bin/phpcs --standard=PSR2 --exclude=Squiz.WhiteSpace.ControlStructureSpacing tests | ||
php-74: | ||
docker: | ||
- image: cimg/php:7.4 | ||
working_directory: ~/php-datatypes | ||
steps: | ||
- checkout | ||
- run: | ||
name: Composer Update | ||
command: composer update | ||
- run: | ||
name: Run Tests for PHPv7.4 | ||
command: phpdbg -qrr vendor/bin/phpunit | ||
|
||
php-80: | ||
docker: | ||
- image: cimg/php:8.0 | ||
working_directory: ~/php-datatypes | ||
steps: | ||
- checkout | ||
- run: | ||
name: Check coding standards in /src | ||
command: vendor/bin/phpcs --standard=PSR2 --exclude=Squiz.WhiteSpace.ControlStructureSpacing src | ||
name: Composer Update | ||
command: composer update | ||
- run: | ||
name: Check coding standards in /tests | ||
command: vendor/bin/phpcs --standard=PSR2 --exclude=Squiz.WhiteSpace.ControlStructureSpacing tests | ||
name: Run Tests for PHPv8.0 | ||
command: phpdbg -qrr vendor/bin/phpunit | ||
|
||
php-81: | ||
docker: | ||
- image: cimg/php:8.1 | ||
working_directory: ~/php-datatypes | ||
steps: | ||
- checkout | ||
- run: | ||
name: Composer Update | ||
command: composer update | ||
- run: | ||
name: Run Tests for PHPv8.1 | ||
command: phpdbg -qrr vendor/bin/phpunit | ||
|
||
php-coverage: | ||
docker: | ||
- image: cimg/php:7.4 | ||
working_directory: ~/php-datatypes | ||
steps: | ||
- checkout | ||
- run: | ||
name: Composer Install | ||
command: composer install | ||
- run: | ||
name: Run Tests for PHPv7.4 | ||
command: phpdbg -qrr vendor/bin/phpunit --coverage-clover ~/build/coverage-report | ||
- store_artifacts: | ||
path: ~/build/coverage-report | ||
path: ~/build/coverage-report | ||
- codecov/upload: | ||
file: ~/build/coverage-report | ||
|
||
|
||
workflows: | ||
ci-flow: | ||
jobs: | ||
- php-cs | ||
- php-74: | ||
requires: | ||
- php-cs | ||
- php-80: | ||
requires: | ||
- php-cs | ||
- php-81: | ||
requires: | ||
- php-cs | ||
- php-coverage: | ||
requires: | ||
- php-74 | ||
- php-80 | ||
- php-81 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
ci/ | ||
vendor/ | ||
notyetdeveloped/ | ||
.buildpath | ||
.project | ||
composer.lock | ||
phpunit.xml | ||
.phpunit.result.cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,27 @@ | ||
<phpunit bootstrap="tests/bootstrap.php" | ||
backupGlobals="false" | ||
backupStaticAttributes="false" | ||
colors="true" | ||
verbose="false" | ||
convertErrorsToExceptions="true" | ||
convertNoticesToExceptions="true" | ||
convertWarningsToExceptions="true" | ||
processIsolation="false" | ||
stopOnFailure="false"> | ||
<?xml version="1.0"?> | ||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
bootstrap="tests/bootstrap.php" | ||
backupGlobals="false" | ||
backupStaticAttributes="false" | ||
colors="true" | ||
verbose="false" | ||
convertErrorsToExceptions="true" | ||
convertNoticesToExceptions="true" | ||
convertWarningsToExceptions="true" | ||
processIsolation="false" | ||
stopOnFailure="false" | ||
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"> | ||
|
||
<testsuites> | ||
<testsuite name="Unit"> | ||
<directory>tests/Unit</directory> | ||
</testsuite> | ||
</testsuites> | ||
<coverage processUncoveredFiles="true"> | ||
<include> | ||
<directory suffix=".php">src</directory> | ||
</include> | ||
</coverage> | ||
|
||
<filter> | ||
<whitelist processUncoveredFilesFromWhitelist="true"> | ||
<directory suffix=".php">src</directory> | ||
</whitelist> | ||
</filter> | ||
<testsuites> | ||
<testsuite name="Unit"> | ||
<directory suffix="Test.php">tests/Unit</directory> | ||
</testsuite> | ||
</testsuites> | ||
|
||
</phpunit> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace HraDigital\Datatypes\Attributes\General; | ||
|
||
/** | ||
* Gives Activation information capabilities to an Entity/Value Object. | ||
* | ||
* @package HraDigital\Datatypes | ||
* @copyright HraDigital\Datatypes | ||
* @license MIT | ||
*/ | ||
trait HasActiveTrait | ||
{ | ||
/** @var bool $active - If the record is marked as ACTIVE in the system. */ | ||
protected bool $active = false; | ||
|
||
/** | ||
* Sets the active value of an Entity. | ||
* | ||
* @param bool $active - New active value. | ||
* @return void | ||
*/ | ||
protected function castActive(bool $active): void | ||
{ | ||
$this->active = $active; | ||
} | ||
|
||
/** | ||
* Returns TRUE if the record is marked as ACTIVE in the system. | ||
* | ||
* @return bool | ||
*/ | ||
public function isActive(): bool | ||
{ | ||
return $this->active; | ||
} | ||
} |
Oops, something went wrong.