Skip to content

Commit

Permalink
Merge pull request #420 from wayofdev/fix/infection
Browse files Browse the repository at this point in the history
  • Loading branch information
lotyp authored Jun 13, 2024
2 parents fd544d7 + 3a90d44 commit 65047bf
Show file tree
Hide file tree
Showing 10 changed files with 109 additions and 33 deletions.
58 changes: 29 additions & 29 deletions .github/assets/deptrac.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,28 @@ Check full instructions in [docker-shared-services](https://github.com/wayofdev/

<br>

## 🧰 Project Architecture

The project architecture of `wayofdev/laravel-starter-tpl` follows a structured approach with distinct layers:

* **Domain:** Contains core business logic and entities.
* **Bridge:** Connects the domain layer with external systems or services.
* **Infrastructure:** Handles interactions with external systems, such as databases, APIs, or file systems.
* **Support:** Provides general-purpose helper classes that assist various parts of the application.
* **DatabaseSeeders:** Handles database seeding logic.
* **DatabaseFactories:** Manages database factory definitions.
* **Tests:** Contains test cases for various layers of the application.

Each layer has defined dependencies, ensuring a clear separation of concerns and facilitating maintainability and scalability.

For more information check [deptrac.yaml](https://github.com/wayofdev/laravel-starter-tpl/blob/develop/app/deptrac.yaml) located in repository `app` folder.

### → Architecture Diagram

![Architecture Diagram](.github/assets/deptrac.svg)

<br>

## 🤖 Deployment to Staging and Production

This repository utilizes GitHub Actions for continuous deployment to both staging and production servers. Below is a description.
Expand Down
1 change: 1 addition & 0 deletions app/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
"Database\\Factories\\": "database/factories/",
"Database\\Seeders\\": "database/seeders/",
"Domain\\": "src/Domain/",
"Infrastructure\\": "src/Infrastructure/",
"Support\\": "src/Support/"
}
},
Expand Down
11 changes: 10 additions & 1 deletion app/deptrac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ deptrac:
- type: directory
value: src/Bridge/.*

- name: Infrastructure
collectors:
- type: directory
value: src/Infrastructure/.*

- name: Support
collectors:
- type: directory
Expand All @@ -45,9 +50,12 @@ deptrac:
Domain: ~
Bridge:
- Domain
- Infrastructure
- Support
Support:
Infrastructure:
- Domain
- Support
Support:
DatabaseSeeders:
- DatabaseFactories
- Domain
Expand All @@ -56,6 +64,7 @@ deptrac:
Tests:
- Domain
- Bridge
- Infrastructure
- Support
- DatabaseSeeders
- DatabaseFactories
7 changes: 6 additions & 1 deletion app/psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@
<code><![CDATA[$hidden]]></code>
</NonInvariantDocblockPropertyType>
</file>
<file src="src/Support/Filters/FuzzyFilter.php">
<file src="src/Infrastructure/Filters/FuzzyFilter.php">
<MixedAssignment>
<code><![CDATA[$item]]></code>
</MixedAssignment>
Expand Down Expand Up @@ -250,4 +250,9 @@
<code><![CDATA[make]]></code>
</MixedMethodCall>
</file>
<file src="tests/src/Functional/Support/StringUtilsTest.php">
<PossiblyUnusedMethod>
<code><![CDATA[it_converts_string]]></code>
</PossiblyUnusedMethod>
</file>
</files>
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

use Domain\Category\Models\Category;
use Illuminate\Http\Request;
use Infrastructure\Filters\FuzzyFilter;
use Spatie\QueryBuilder\AllowedFilter;
use Spatie\QueryBuilder\QueryBuilder;
use Support\Filters\FuzzyFilter;

final class IndexQuery extends QueryBuilder
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Support\Filters;
namespace Infrastructure\Filters;

use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
Expand Down
16 changes: 16 additions & 0 deletions app/src/Support/StringUtils.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

declare(strict_types=1);

namespace Support;

/**
* This is a stub class, just to show purpose of Support layer.
*/
final class StringUtils
{
public static function toTitleCase(string $str): string
{
return ucwords(strtolower($str));

Check warning on line 14 in app/src/Support/StringUtils.php

View workflow job for this annotation

GitHub Actions / mutation-testing (ubuntu-latest, 8.3, locked)

Escaped Mutant for Mutator "UnwrapStrToLower": --- Original +++ New @@ @@ { public static function toTitleCase(string $str) : string { - return ucwords(strtolower($str)); + return ucwords($str); } }
}
}
Empty file.
23 changes: 23 additions & 0 deletions app/tests/src/Functional/Support/StringUtilsTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

declare(strict_types=1);

namespace Tests\Functional\Support;

use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\TestCase;
use Support\StringUtils;

class StringUtilsTest extends TestCase
{
#[Test]
public function it_converts_string(): void
{
$input = 'hello world';
$expectedOutput = 'Hello World';

$actualOutput = StringUtils::toTitleCase($input);

self::assertSame($expectedOutput, $actualOutput);
}
}

0 comments on commit 65047bf

Please sign in to comment.