-
Notifications
You must be signed in to change notification settings - Fork 11
HP-2512 Cleaned up BillingRegistryService #102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
SilverFire
merged 13 commits into
hiqdev:master
from
VadymHrechukha:HP-2512_cleaned_up_billingregistryservice
Jun 9, 2025
Merged
Changes from 3 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
04c3026
HP-2512 Cleaned up BillingRegistryService
VadymHrechukha bcff484
HP-2512 removed invalid PHPUnit test
VadymHrechukha bbf2803
HP-2512 moved Representation class to php-billing package
VadymHrechukha e797a80
HP-2512 fixed PHPUnit tests
VadymHrechukha cb9c391
HP-2512 removed PHPUnit test duplicate
VadymHrechukha 17e59dd
HP-2512 made BillingRegistryServiceTest is more readable
VadymHrechukha 0e898f7
HP-2512 tiny
VadymHrechukha 1812faa
HP-2512 removed BillingRegistryTariffServiceTest PHPUnit test because…
VadymHrechukha 48f33be
HP-2512 removed the next interfaces because this does not make any se…
VadymHrechukha 73c9162
HP-2512 tiny
VadymHrechukha a3e00ee
HP-2512 created BillingRegistryService::getPriceTypeDefinitionByPrice…
VadymHrechukha 5f0f649
HP-2512 tiny
VadymHrechukha f146bba
HP-2512 tiny
VadymHrechukha File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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
16 changes: 16 additions & 0 deletions
16
src/product/Application/BillingRegistryTariffServiceInterface.php
This file contains hidden or 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,16 @@ | ||
| <?php declare(strict_types=1); | ||
|
|
||
| namespace hiqdev\php\billing\product\Application; | ||
|
|
||
| use hiqdev\php\billing\product\Exception\TariffTypeDefinitionNotFoundException; | ||
| use hiqdev\php\billing\product\TariffTypeDefinitionInterface; | ||
|
|
||
| interface BillingRegistryTariffServiceInterface | ||
| { | ||
| /** | ||
| * @param string $tariffName | ||
| * @return TariffTypeDefinitionInterface | ||
| * @throws TariffTypeDefinitionNotFoundException | ||
| */ | ||
| public function getTariffTypeDefinitionByName(string $tariffName): TariffTypeDefinitionInterface; | ||
| } |
18 changes: 0 additions & 18 deletions
18
src/product/Application/BillingRegistryTariffServiseInterface.php
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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 hiqdev\php\billing\product\invoice; | ||
|
|
||
| use hiqdev\php\billing\type\TypeInterface; | ||
|
|
||
| /** | ||
| * This class is made abstract intentionally. | ||
| * Because you can attach multiple representations, and thus you should distinguish them somehow. | ||
| * So, please implement you own representation. | ||
| */ | ||
| abstract class Representation implements RepresentationInterface | ||
| { | ||
| private TypeInterface $type; | ||
|
|
||
| public function __construct(private readonly string $sql) | ||
| { | ||
| if (trim($this->sql) === '') { | ||
| throw new InvalidRepresentationException('Representation SQL cannot be empty.'); | ||
| } | ||
| } | ||
|
|
||
| public function getSql(): string | ||
| { | ||
| return $this->sql; | ||
| } | ||
|
|
||
| public function setType(TypeInterface $type): RepresentationInterface | ||
| { | ||
| $this->type = $type; | ||
|
|
||
| return $this; | ||
| } | ||
|
|
||
| public function getType(): TypeInterface | ||
| { | ||
| return $this->type; | ||
| } | ||
| } |
This file contains hidden or 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 hidden or 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 hidden or 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,9 @@ | ||
| <?php declare(strict_types=1); | ||
|
|
||
| namespace hiqdev\php\billing\tests\unit\product\invoice; | ||
|
|
||
| use hiqdev\php\billing\product\invoice\Representation; | ||
|
|
||
| class TestRepresentation extends Representation | ||
| { | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
🧩 Analysis chain
Fix the duplicate representation issue causing test failure.
The pipeline failure indicates a
DuplicateRepresentationExceptionwith "TestRepresentation:dummy", but the test creates instances with different parameters ("Invoice" and "Payment Request"). This suggests the representation identification mechanism doesn't use the constructor parameter as expected.Please investigate how representations are identified internally. Run this script to examine the TestRepresentation implementation and related identification logic:
🏁 Script executed:
Length of output: 1975
🏁 Script executed:
Length of output: 1116
🏁 Script executed:
Length of output: 8781
Include SQL in representation key to avoid false duplicates
The uniqueness guard currently generates keys using only the representation class and type, so both
new TestRepresentation("Invoice")andnew TestRepresentation("Payment Request")yield the same"TestRepresentation:dummy"key. To fix this, extend the key to include the SQL string:• File needing update:
• Proposed diff:
This change ensures each representation’s SQL is factored into uniqueness, resolving the
DuplicateRepresentationExceptionin tests.🧰 Tools
🪛 GitHub Actions: phpunit-tests
[error] 54-54: hiqdev\php\billing\product\invoice\DuplicateRepresentationException: Duplicate 'TestRepresentation:dummy' representation causing test failure in testGetRepresentationsByInterfaceReturnsAllRepresentations.
🤖 Prompt for AI Agents