Skip to content

Commit

Permalink
Fixing PHPSpec
Browse files Browse the repository at this point in the history
  • Loading branch information
gplanchat committed Nov 14, 2023
1 parent 0b00b01 commit 0c84c1b
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 3 deletions.
50 changes: 49 additions & 1 deletion spec/ComplexResultBucketSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@ function it_has_non_empty_acceptance()
new \stdClass()
),
new RejectionResultBucket(
'Lorem ipsum dolor sit amet',
new \Exception('Lorem ipsum dolor sit amet'),
new \stdClass(),
new \stdClass(),
new \stdClass(),
new \stdClass()
),
new AcceptanceResultBucket(
new \stdClass()
Expand All @@ -50,6 +52,16 @@ public function walkRejection(): iterable
new \stdClass()
];
}

public function reasons(): ?array
{
return null;
}

public function exceptions(): ?array
{
return null;
}
},
new class implements AcceptanceResultBucketInterface, RejectionResultBucketInterface {
public function walkAcceptance(): iterable
Expand Down Expand Up @@ -77,6 +89,16 @@ public function getIterator(): \Traversable
}
};
}

public function reasons(): ?array
{
return null;
}

public function exceptions(): ?array
{
return null;
}
}
);

Expand All @@ -87,6 +109,8 @@ function it_has_non_empty_rejection()
{
$this->beConstructedWith(
new RejectionResultBucket(
'Lorem ipsum dolor sit amet',
new \Exception('Lorem ipsum dolor sit amet'),
new \stdClass(),
new \stdClass()
),
Expand All @@ -96,6 +120,8 @@ function it_has_non_empty_rejection()
new \stdClass()
),
new RejectionResultBucket(
'Lorem ipsum dolor sit amet',
new \Exception('Lorem ipsum dolor sit amet'),
new \stdClass()
),
new class implements AcceptanceResultBucketInterface, RejectionResultBucketInterface {
Expand All @@ -114,6 +140,16 @@ public function walkRejection(): iterable
new \stdClass()
];
}

public function reasons(): ?array
{
return null;
}

public function exceptions(): ?array
{
return null;
}
},
new class implements AcceptanceResultBucketInterface, RejectionResultBucketInterface {
public function walkAcceptance(): iterable
Expand Down Expand Up @@ -141,6 +177,16 @@ public function getIterator(): \Traversable
}
};
}

public function reasons(): ?array
{
return null;
}

public function exceptions(): ?array
{
return null;
}
}
);

Expand All @@ -162,6 +208,8 @@ function it_can_accept_values()
function it_can_reject_values()
{
$this->reject(
'Lorem ipsum dolor sit amet',
new \Exception('Lorem ipsum dolor sit amet'),
new \stdClass(),
new \stdClass(),
new \stdClass()
Expand Down
8 changes: 7 additions & 1 deletion spec/IteratorRejectionResultBucketSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ class IteratorRejectionResultBucketSpec extends ObjectBehavior
{
function it_is_initializable()
{
$this->beConstructedWith(new \EmptyIterator());
$this->beConstructedWith(
'Lorem ipsum dolor sit amet',
new \Exception('Lorem ipsum dolor sit amet'),
new \EmptyIterator()
);

$this->shouldHaveType(IteratorRejectionResultBucket::class);
$this->shouldBeAnInstanceOf(RejectionResultBucketInterface::class);
Expand All @@ -20,6 +24,8 @@ function it_is_initializable()
function it_has_non_empty_rejection()
{
$this->beConstructedWith(
'Lorem ipsum dolor sit amet',
new \Exception('Lorem ipsum dolor sit amet'),
new \ArrayIterator([
new \stdClass(),
new \stdClass(),
Expand Down
9 changes: 8 additions & 1 deletion spec/RejectionResultBucketSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,23 @@ class RejectionResultBucketSpec extends ObjectBehavior
{
function it_is_initializable()
{
$this->beConstructedWith(
'Lorem ipsum dolor sit amet',
new \Exception('Lorem ipsum dolor sit amet'),
);

$this->shouldHaveType(RejectionResultBucket::class);
$this->shouldBeAnInstanceOf(RejectionResultBucketInterface::class);
}

function it_has_non_empty_rejection()
{
$this->beConstructedWith(
'Lorem ipsum dolor sit amet',
new \Exception('Lorem ipsum dolor sit amet'),
new \stdClass(),
new \stdClass(),
new \stdClass(),
new \stdClass()
);

$this->walkRejection()->shouldHaveCount(3);
Expand Down

0 comments on commit 0c84c1b

Please sign in to comment.