diff --git a/src/Enum/BucketAllocationType.php b/src/Enum/BucketAllocationType.php new file mode 100644 index 0000000..59ee44e --- /dev/null +++ b/src/Enum/BucketAllocationType.php @@ -0,0 +1,10 @@ + + */ + public function getAllowedAllocationTypes(): array + { + return match ($this) { + self::NEED, self::WANT => [ + BucketAllocationType::FIXED_LIMIT, + BucketAllocationType::PERCENTAGE, + ], + self::OVERFLOW => [ + BucketAllocationType::UNLIMITED, + ], + }; + } +} diff --git a/src/Enum/DistributionMode.php b/src/Enum/DistributionMode.php new file mode 100644 index 0000000..b418f7e --- /dev/null +++ b/src/Enum/DistributionMode.php @@ -0,0 +1,9 @@ +assertSame('need', BucketType::NEED->value); + $this->assertSame('want', BucketType::WANT->value); + $this->assertSame('overflow', BucketType::OVERFLOW->value); + + $this->assertSame( + [BucketAllocationType::FIXED_LIMIT, BucketAllocationType::PERCENTAGE], + BucketType::NEED->getAllowedAllocationTypes(), + ); + + $this->assertSame( + [BucketAllocationType::FIXED_LIMIT, BucketAllocationType::PERCENTAGE], + BucketType::WANT->getAllowedAllocationTypes(), + ); + + $this->assertSame( + [BucketAllocationType::UNLIMITED], + BucketType::OVERFLOW->getAllowedAllocationTypes(), + ); + } +} diff --git a/tests/Enum/RemainingEnumsTest.php b/tests/Enum/RemainingEnumsTest.php new file mode 100644 index 0000000..4dbcfa5 --- /dev/null +++ b/tests/Enum/RemainingEnumsTest.php @@ -0,0 +1,36 @@ +assertSame('once', StreamFrequency::ONCE->value); + $this->assertSame('daily', StreamFrequency::DAILY->value); + $this->assertSame('weekly', StreamFrequency::WEEKLY->value); + $this->assertSame('biweekly', StreamFrequency::BIWEEKLY->value); + $this->assertSame('monthly', StreamFrequency::MONTHLY->value); + $this->assertSame('quarterly', StreamFrequency::QUARTERLY->value); + $this->assertSame('yearly', StreamFrequency::YEARLY->value); + + $this->assertSame('income', StreamType::INCOME->value); + $this->assertSame('expense', StreamType::EXPENSE->value); + + $this->assertSame('even', DistributionMode::EVEN->value); + $this->assertSame('priority', DistributionMode::PRIORITY->value); + } + + public function testBucketAllocationTypeBackingValues(): void + { + $this->assertSame('fixed_limit', BucketAllocationType::FIXED_LIMIT->value); + $this->assertSame('percentage', BucketAllocationType::PERCENTAGE->value); + $this->assertSame('unlimited', BucketAllocationType::UNLIMITED->value); + } +}