Skip to content

Commit e945ee9

Browse files
committed
Test the aliases
1 parent cc473c0 commit e945ee9

File tree

4 files changed

+12
-60
lines changed

4 files changed

+12
-60
lines changed

src/Component/legacy/spec/Exception/DeleteHandlingExceptionSpec.php

Lines changed: 3 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -14,38 +14,12 @@
1414
namespace spec\Sylius\Component\Resource\Exception;
1515

1616
use PhpSpec\ObjectBehavior;
17-
use Sylius\Resource\Exception\ExceptionInterface;
18-
use Sylius\Resource\Exception\RuntimeException;
17+
use Sylius\Resource\Exception\DeleteHandlingException as NewDeleteHandlingException;
1918

2019
final class DeleteHandlingExceptionSpec extends ObjectBehavior
2120
{
22-
function it_extends_an_exception(): void
21+
function it_should_be_an_alias_of_delete_handling_exception(): void
2322
{
24-
$this->shouldHaveType(\Exception::class);
25-
}
26-
27-
function it_is_a_runtime_exception(): void
28-
{
29-
$this->shouldHaveType(RuntimeException::class);
30-
}
31-
32-
function it_implements_exception_interface(): void
33-
{
34-
$this->shouldImplement(ExceptionInterface::class);
35-
}
36-
37-
function it_has_a_message(): void
38-
{
39-
$this->getMessage()->shouldReturn('Ups, something went wrong during deleting a resource, please try again.');
40-
}
41-
42-
function it_has_a_flash(): void
43-
{
44-
$this->getFlash()->shouldReturn('something_went_wrong_error');
45-
}
46-
47-
function it_has_an_api_response_code(): void
48-
{
49-
$this->getApiResponseCode()->shouldReturn(500);
23+
$this->shouldBeAnInstanceOf(NewDeleteHandlingException::class);
5024
}
5125
}

src/Component/legacy/spec/Exception/UnexpectedTypeExceptionSpec.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
namespace spec\Sylius\Component\Resource\Exception;
1515

1616
use PhpSpec\ObjectBehavior;
17+
use Sylius\Resource\Exception\UnexpectedTypeException as NewUnexpectedTypeException;
1718

1819
final class UnexpectedTypeExceptionSpec extends ObjectBehavior
1920
{
@@ -22,13 +23,8 @@ function let(): void
2223
$this->beConstructedWith('stringValue', '\ExpectedType');
2324
}
2425

25-
function it_extends_invalid_argument_exception(): void
26+
function it_should_be_an_alias_of_unexpected_type_exception(): void
2627
{
27-
$this->shouldHaveType(\InvalidArgumentException::class);
28-
}
29-
30-
function it_has_a_message(): void
31-
{
32-
$this->getMessage()->shouldReturn('Expected argument of type "\ExpectedType", "string" given.');
28+
$this->shouldBeAnInstanceOf(NewUnexpectedTypeException::class);
3329
}
3430
}

src/Component/legacy/spec/Exception/UnsupportedMethodExceptionSpec.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
namespace spec\Sylius\Component\Resource\Exception;
1515

1616
use PhpSpec\ObjectBehavior;
17+
use Sylius\Resource\Exception\UnsupportedMethodException as NewUnsupportedMethodException;
1718

1819
final class UnsupportedMethodExceptionSpec extends ObjectBehavior
1920
{
@@ -22,13 +23,8 @@ function let(): void
2223
$this->beConstructedWith('methodName');
2324
}
2425

25-
function it_extends_exception(): void
26+
function it_should_be_an_alias_of_unsupported_method_exception(): void
2627
{
27-
$this->shouldHaveType(\Exception::class);
28-
}
29-
30-
function it_has_a_message(): void
31-
{
32-
$this->getMessage()->shouldReturn('The method "methodName" is not supported.');
28+
$this->shouldBeAnInstanceOf(NewUnsupportedMethodException::class);
3329
}
3430
}

src/Component/legacy/spec/Exception/UpdateHandlingExceptionSpec.php

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,26 +14,12 @@
1414
namespace spec\Sylius\Component\Resource\Exception;
1515

1616
use PhpSpec\ObjectBehavior;
17+
use Sylius\Resource\Exception\UpdateHandlingException as NewUpdateHandlingException;
1718

1819
final class UpdateHandlingExceptionSpec extends ObjectBehavior
1920
{
20-
function it_extends_an_exception(): void
21+
function it_should_be_an_alias_of_unsupported_method_exception(): void
2122
{
22-
$this->shouldHaveType(\Exception::class);
23-
}
24-
25-
function it_has_a_message(): void
26-
{
27-
$this->getMessage()->shouldReturn('Ups, something went wrong during updating a resource, please try again.');
28-
}
29-
30-
function it_has_a_flash(): void
31-
{
32-
$this->getFlash()->shouldReturn('something_went_wrong_error');
33-
}
34-
35-
function it_has_an_api_response_code(): void
36-
{
37-
$this->getApiResponseCode()->shouldReturn(400);
23+
$this->shouldBeAnInstanceOf(NewUpdateHandlingException::class);
3824
}
3925
}

0 commit comments

Comments
 (0)