66
77use Google \Protobuf \Timestamp ;
88use PHPUnit \Framework \SkippedTest ;
9- use PHPUnit \Framework \SkippedWithMessageException ;
10- use PHPUnit \Framework \TestStatus \Skipped ;
119use Psr \Log \LoggerInterface ;
1210use Spiral \Core \Container ;
1311use Spiral \Core \Scope ;
@@ -36,16 +34,16 @@ protected function setUp(): void
3634
3735 protected function runTest (): mixed
3836 {
39- $ c = ContainerFacade::$ container ;
37+ $ container = ContainerFacade::$ container ;
4038 /** @var State $runtime */
41- $ runtime = $ c ->get (State::class);
39+ $ runtime = $ container ->get (State::class);
4240 $ feature = $ runtime ->getFeatureByTestCase (static ::class);
4341
4442 // Configure client logger
4543 $ logger = LoggerFactory::createClientLogger ($ feature ->taskQueue );
4644 $ logger ->clear ();
4745
48- return $ c ->runScope (
46+ return $ container ->runScope (
4947 new Scope (name: 'feature ' , bindings: [
5048 Feature::class => $ feature ,
5149 static ::class => $ this ,
@@ -62,7 +60,15 @@ function (Container $container): mixed {
6260 return parent ::runTest ();
6361 } catch (\Throwable $ e ) {
6462 if ($ e instanceof TemporalException) {
65- echo "\n=== Workflow history for failed test {$ this ->name ()} === \n" ;
63+ echo \sprintf (
64+ "\n=== En error occurred while testing %s: %s (%s) === \n" ,
65+ static ::class . ':: ' . $ this ->name (),
66+ $ e ->getMessage (),
67+ $ e ::class,
68+ );
69+ echo "\n=== Stack trace === \n" ;
70+ echo $ e ->getTraceAsString ();
71+ echo "\n=== Workflow history === \n" ;
6672 $ this ->printWorkflowHistory ($ container ->get (WorkflowClientInterface::class), $ args );
6773
6874 $ logRecords = $ container ->get (ClientLogger::class)->getRecords ();
@@ -117,9 +123,7 @@ private function printWorkflowHistory(WorkflowClientInterface $workflowClient, a
117123 ? 0
118124 : $ ts ->getSeconds () + \round ($ ts ->getNanos () / 1_000_000_000 , 6 );
119125
120- foreach ($ workflowClient ->getWorkflowHistory (
121- $ arg ->getExecution (),
122- ) as $ event ) {
126+ foreach ($ workflowClient ->getWorkflowHistory ($ arg ->getExecution ()) as $ event ) {
123127 $ start ??= $ fnTime ($ event ->getEventTime ());
124128 echo "\n" . \str_pad ((string ) $ event ->getEventId (), 3 , ' ' , STR_PAD_LEFT ) . ' ' ;
125129 # Calculate delta time
0 commit comments