Skip to content

Commit bd2e69b

Browse files
authored
Merge pull request #15 from KaririCode-Framework/develop
fix(processor-pipeline): correct exception handling in tests
2 parents adab5ba + 4809aaa commit bd2e69b

File tree

2 files changed

+75
-71
lines changed

2 files changed

+75
-71
lines changed

composer.lock

Lines changed: 69 additions & 67 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/AttributeHandlerTest.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
use KaririCode\Contract\Processor\Attribute\ProcessableAttribute;
99
use KaririCode\Contract\Processor\Pipeline;
1010
use KaririCode\Contract\Processor\ProcessorBuilder;
11-
use KaririCode\ProcessorPipeline\Exception\ProcessingException;
11+
use KaririCode\ProcessorPipeline\Exception\ProcessorRuntimeException;
1212
use KaririCode\PropertyInspector\AttributeHandler;
1313
use KaririCode\PropertyInspector\Processor\ProcessorConfigBuilder;
1414
use KaririCode\PropertyInspector\Processor\ProcessorValidator;
@@ -218,7 +218,9 @@ public function testHandleAttributeWithProcessingException(): void
218218

219219
$mockPipeline->expects($this->once())
220220
->method('process')
221-
->willThrowException(new ProcessingException('Test error'));
221+
->willThrowException(
222+
ProcessorRuntimeException::contextNotFound('payment')
223+
);
222224

223225
$this->processorBuilder->expects($this->once())
224226
->method('buildPipeline')
@@ -228,7 +230,7 @@ public function testHandleAttributeWithProcessingException(): void
228230
$this->assertSame('initialValue', $result);
229231

230232
$errors = $this->attributeHandler->getProcessingResultErrors();
231-
$this->assertArrayHasKey('testProperty', $errors);
232-
$this->assertContains('Test error', $errors['testProperty']);
233+
234+
$this->assertStringContainsString("Processor context 'payment' not found", $errors['testProperty'][0]);
233235
}
234236
}

0 commit comments

Comments
 (0)