-
Notifications
You must be signed in to change notification settings - Fork 524
Allow brick math 0.15 and 0.16 #633
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
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,15 +4,11 @@ | |
|
|
||
| namespace Ramsey\Uuid\Test\Builder; | ||
|
|
||
| use Mockery; | ||
| use Ramsey\Uuid\Builder\FallbackBuilder; | ||
| use Ramsey\Uuid\Builder\UuidBuilderInterface; | ||
| use Ramsey\Uuid\Codec\CodecInterface; | ||
| use Ramsey\Uuid\Codec\StringCodec; | ||
| use Ramsey\Uuid\Converter\Number\GenericNumberConverter; | ||
| use Ramsey\Uuid\Converter\Time\GenericTimeConverter; | ||
| use Ramsey\Uuid\Converter\Time\PhpTimeConverter; | ||
| use Ramsey\Uuid\Exception\BuilderNotFoundException; | ||
| use Ramsey\Uuid\Exception\UnableToBuildUuidException; | ||
| use Ramsey\Uuid\Guid\GuidBuilder; | ||
| use Ramsey\Uuid\Math\BrickMathCalculator; | ||
|
|
@@ -25,41 +21,41 @@ | |
|
|
||
| class FallbackBuilderTest extends TestCase | ||
| { | ||
| public function testBuildThrowsExceptionAfterAllConfiguredBuildersHaveErrored(): void | ||
| { | ||
| $codec = Mockery::mock(CodecInterface::class); | ||
| $bytes = 'foobar'; | ||
|
|
||
| $builder1 = Mockery::mock(UuidBuilderInterface::class); | ||
| $builder1 | ||
| ->shouldReceive('build') | ||
| ->once() | ||
| ->with($codec, $bytes) | ||
| ->andThrow(UnableToBuildUuidException::class); | ||
|
|
||
| $builder2 = Mockery::mock(UuidBuilderInterface::class); | ||
| $builder2 | ||
| ->shouldReceive('build') | ||
| ->once() | ||
| ->with($codec, $bytes) | ||
| ->andThrow(UnableToBuildUuidException::class); | ||
|
|
||
| $builder3 = Mockery::mock(UuidBuilderInterface::class); | ||
| $builder3 | ||
| ->shouldReceive('build') | ||
| ->once() | ||
| ->with($codec, $bytes) | ||
| ->andThrow(UnableToBuildUuidException::class); | ||
|
|
||
| $fallbackBuilder = new FallbackBuilder([$builder1, $builder2, $builder3]); | ||
|
|
||
| $this->expectException(BuilderNotFoundException::class); | ||
| $this->expectExceptionMessage( | ||
| 'Could not find a suitable builder for the provided codec and fields' | ||
| ); | ||
|
|
||
| $fallbackBuilder->build($codec, $bytes); | ||
| } | ||
| // public function testBuildThrowsExceptionAfterAllConfiguredBuildersHaveErrored(): void | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why are these tests commented out?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My bad, i think i commented them out to debug something. It should be fine to uncomment them again |
||
| // { | ||
| // $codec = Mockery::mock(CodecInterface::class); | ||
| // $bytes = 'foobar'; | ||
| // | ||
| // $builder1 = Mockery::mock(UuidBuilderInterface::class); | ||
| // $builder1 | ||
| // ->shouldReceive('build') | ||
| // ->once() | ||
| // ->with($codec, $bytes) | ||
| // ->andThrow(UnableToBuildUuidException::class); | ||
| // | ||
| // $builder2 = Mockery::mock(UuidBuilderInterface::class); | ||
| // $builder2 | ||
| // ->shouldReceive('build') | ||
| // ->once() | ||
| // ->with($codec, $bytes) | ||
| // ->andThrow(UnableToBuildUuidException::class); | ||
| // | ||
| // $builder3 = Mockery::mock(UuidBuilderInterface::class); | ||
| // $builder3 | ||
| // ->shouldReceive('build') | ||
| // ->once() | ||
| // ->with($codec, $bytes) | ||
| // ->andThrow(UnableToBuildUuidException::class); | ||
| // | ||
| // $fallbackBuilder = new FallbackBuilder([$builder1, $builder2, $builder3]); | ||
| // | ||
| // $this->expectException(BuilderNotFoundException::class); | ||
| // $this->expectExceptionMessage( | ||
| // 'Could not find a suitable builder for the provided codec and fields' | ||
| // ); | ||
| // | ||
| // $fallbackBuilder->build($codec, $bytes); | ||
| // } | ||
|
|
||
| /** | ||
| * @dataProvider provideBytes | ||
|
|
||
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.
Alternatively and a matter of taste, but this could also work instead of the static $roundingModeMap.
With this approach, you don't need
defined(). The whole compat layer would be these 10 lines.