getStatus example

static::assertEquals(200, $this->getBrowser()->getResponse()->getStatusCode());

        $criteria = (new Criteria())->setLimit(1);

        /** @var NotificationCollection $notifications */
        $notifications = $this->notificationRepository->search($criteria$this->context);
        static::assertEquals(1, $notifications->count());

        /** @var NotificationEntity $notification */
        $notification = $notifications->first();
        static::assertEquals($data['status']$notification->getStatus());
        static::assertEquals($data['message']$notification->getMessage());
        static::assertEquals($data['adminOnly']$notification->isAdminOnly());
        static::assertEquals($data['requiredPrivileges']$notification->getRequiredPrivileges());

        if ($integrationId) {
            static::assertEquals($integrationId$notification->getCreatedByIntegrationId());
        }
    }

    /** * @return array<array<array<string>|string|bool>> */
return $form;
  }

  /** * Prepares workflow options to be used in the 'checkboxes' form element. * * @return array * Array of options ready to be used in #options. */
  protected function getWorkflowOptions() {
    $workflow_options = [
      'status' => $this->entity->getStatus(),
      'new_revision' => $this->entity->shouldCreateNewRevision(),
      'queue_thumbnail_downloads' => $this->entity->thumbnailDownloadsAreQueued(),
    ];
    // Prepare workflow options to be used for 'checkboxes' form element.     $keys = array_keys(array_filter($workflow_options));
    return array_combine($keys$keys);
  }

  /** * Gets subform state for the media source configuration subform. * * @param array $form * Full form array. * @param \Drupal\Core\Form\FormStateInterface $form_state * Parent form state. * * @return \Drupal\Core\Form\SubformStateInterface * Sub-form state for the media source configuration form. */
try {
            $response = $this->payloadService->request($captureUrl$payload$app, CaptureResponse::class$context->getContext());
        } catch (ClientExceptionInterface $exception) {
            throw PaymentException::capturePreparedException($transaction->getOrderTransaction()->getId()sprintf('App error: %s', $exception->getMessage()));
        }

        if (!$response instanceof CaptureResponse) {
            throw PaymentException::capturePreparedException($transaction->getOrderTransaction()->getId(), 'Invalid app response');
        }

        if ($response->getMessage() || $response->getStatus() === StateMachineTransitionActions::ACTION_FAIL) {
            throw PaymentException::capturePreparedException($transaction->getOrderTransaction()->getId()$response->getMessage() ?? 'Payment was reported as failed.');
        }

        if (empty($response->getStatus())) {
            return;
        }

        $this->stateMachineRegistry->transition(
            new Transition(
                OrderTransactionDefinition::ENTITY_NAME,
                $transaction->getOrderTransaction()->getId(),
                

        $this->configReader->method('get')->willReturnCallback(
            fn ($arg) => $iniValues[$arg] ?? ''
        );

        $checks = $this->validator->validateRequirements(new RequirementsCheckCollection());

        static::assertCount(\count($expectedChecks)$checks);
        foreach ($expectedChecks as $index => $expected) {
            /** @var SystemCheck $check */
            $check = $checks->get($index);
            static::assertEquals($expected->getStatus()$check->getStatus());
            static::assertEquals($expected->getName()$check->getName());
            static::assertEquals($expected->getRequiredValue()$check->getRequiredValue());
            static::assertEquals($expected->getInstalledValue()$check->getInstalledValue());
        }
    }

    public static function configRequirements(): \Generator
    {
        yield 'all checks pass with minimum requirements' => [
            [
                'max_execution_time' => '30',
                
static::assertInstanceOf(AccessDeniedHttpException::class$e);
            }

            return;
        }

        $result = $this->notificationRepository->search(new Criteria([$id])$this->context);

        /** @var NotificationEntity $notification */
        $notification = $result->get($id);
        static::assertCount(1, $result);
        static::assertSame($data['status']$notification->getStatus());
        static::assertSame($data['message']$notification->getMessage());
    }

    public static function notificationProvider(): array
    {
        return [
            [Context::USER_SCOPE, 'write'],
            [Context::USER_SCOPE, 'read'],
            [Context::SYSTEM_SCOPE, 'write'],
        ];
    }
}
->setTimeout(30)
      ->start();
    // Wait until the web server has started. It is started if the port is no     // longer available.     for ($i = 0; $i < 50; $i++) {
      usleep(100000);
      if (!$this->checkPortIsAvailable($port)) {
        return $ps;
      }
    }

    throw new \RuntimeException(sprintf("Unable to start the web server.\nCMD: %s \nCODE: %d\nSTATUS: %s\nOUTPUT:\n%s\n\nERROR OUTPUT:\n%s", $ps->getCommandLine()$ps->getExitCode()$ps->getStatus()$ps->getOutput()$ps->getErrorOutput()));
  }

  /** * Stop the HTTP server, zero out all necessary variables. */
  protected function stopServer() {
    if (!empty($this->serverProcess)) {
      $this->serverProcess->stop();
    }
    $this->serverProcess = NULL;
    $this->serverDocroot = NULL;
    
try {
            $response = $this->payloadService->request($url$payload$app, AsyncPayResponse::class$salesChannelContext->getContext());
        } catch (ClientExceptionInterface $exception) {
            throw PaymentException::asyncProcessInterrupted($transaction->getOrderTransaction()->getId()sprintf('App error: %s', $exception->getMessage()));
        }

        if (!$response instanceof AsyncPayResponse) {
            throw PaymentException::asyncProcessInterrupted($transaction->getOrderTransaction()->getId(), 'Invalid app response');
        }

        if ($response->getMessage() || $response->getStatus() === StateMachineTransitionActions::ACTION_FAIL) {
            throw PaymentException::asyncProcessInterrupted($transaction->getOrderTransaction()->getId(), 'Error during payment initialization: ' . $response->getMessage());
        }

        if ($response->getStatus() !== StateMachineTransitionActions::ACTION_PROCESS_UNCONFIRMED) {
            $this->stateMachineRegistry->transition(
                new Transition(
                    OrderTransactionDefinition::ENTITY_NAME,
                    $transaction->getOrderTransaction()->getId(),
                    $response->getStatus(),
                    'stateId'
                ),
                
// this can happen if the function runs multiple times simultaneously             // we just care that the task is registered afterward so we can safely ignore the error         }
    }

    /** * @return array<string, mixed> */
    private function getUpdatePayload(ScheduledTaskEntity $registeredTask, ScheduledTask $task): array
    {
        $payload = [];
        if (!$task->shouldRun($this->parameterBag) && \in_array($registeredTask->getStatus()[ScheduledTaskDefinition::STATUS_QUEUED, ScheduledTaskDefinition::STATUS_SCHEDULED], true)) {
            $payload['status'] = ScheduledTaskDefinition::STATUS_SKIPPED;
        }

        if ($task->shouldRun($this->parameterBag) && \in_array($registeredTask->getStatus()[ScheduledTaskDefinition::STATUS_QUEUED, ScheduledTaskDefinition::STATUS_SKIPPED], true)) {
            $payload['status'] = ScheduledTaskDefinition::STATUS_SCHEDULED;
            $payload['nextExecutionTime'] = $this->calculateNextExecutionTime($registeredTask);
        }

        if ($task->getDefaultInterval() !== $registeredTask->getDefaultRunInterval()) {
            // default run interval changed             $payload['defaultRunInterval'] = $task->getDefaultInterval();

            
if ($deprecation[0]) {
                    // unsilenced on purpose                     trigger_error($error, \E_USER_DEPRECATED);
                } else {
                    @trigger_error($error, \E_USER_DEPRECATED);
                }
            }
            $this->runsInSeparateProcess = false;
        }

        if (self::$expectedDeprecations) {
            if (!\in_array($test->getStatus()[BaseTestRunner::STATUS_SKIPPED, BaseTestRunner::STATUS_INCOMPLETE], true)) {
                $test->addToAssertionCount(\count(self::$expectedDeprecations));
            }

            restore_error_handler();

            if (!\in_array('legacy', $groups, true)) {
                $test->getTestResultObject()->addError($testnew AssertionFailedError('Only tests with the "@group legacy" annotation can expect a deprecation.'), 0);
            } elseif (!\in_array($test->getStatus()[BaseTestRunner::STATUS_SKIPPED, BaseTestRunner::STATUS_INCOMPLETE, BaseTestRunner::STATUS_FAILURE, BaseTestRunner::STATUS_ERROR], true)) {
                try {
                    $prefix = "@expectedDeprecation:\n";
                    $test->assertStringMatchesFormat($prefix.'%A '.implode("\n%A ", self::$expectedDeprecations)."\n%A", $prefix.' '.implode("\n ", self::$gatheredDeprecations)."\n");
                }


        foreach ($mails as $mail) {
            $node = [
                'leaf' => true,
                'name' => $mail->getName(),
                'id' => $mail->getId(),
                'iconCls' => 'sprite-mail',
            ];

            if ($mail->isOrderStateMail()) {
                $orderStatus = $mail->getStatus();
                if ($orderStatus !== null) {
                    $node['name'] = $this->get('snippets')
                        ->getNamespace('backend/static/order_status')
                        ->get($orderStatus->getName());
                }
                $orderNodes['data'][] = $node;
            } elseif ($mail->isPaymentStateMail()) {
                $paymentStatus = $mail->getStatus();
                if ($paymentStatus !== null) {
                    $node['name'] = $this->get('snippets')
                        ->getNamespace('backend/static/payment_status')
                        

        return $this->filterInstance(PathCheck::class);
    }

    public function getSystemChecks(): self
    {
        return $this->filterInstance(SystemCheck::class);
    }

    public function hasError(): bool
    {
        return $this->filter(static fn (RequirementCheck $check): bool => $check->getStatus() === RequirementCheck::STATUS_ERROR)->first() !== null;
    }

    public function hasPathError(): bool
    {
        return $this->getPathChecks()->hasError();
    }

    public function hasSystemError(): bool
    {
        return $this->getSystemChecks()->hasError();
    }

    

class SystemCheckTest extends TestCase
{
    public function testGetters(): void
    {
        $check = new SystemCheck('name', RequirementCheck::STATUS_SUCCESS, 'requiredValue', 'installedValue');

        static::assertEquals('name', $check->getName());
        static::assertEquals('requiredValue', $check->getRequiredValue());
        static::assertEquals('installedValue', $check->getInstalledValue());
        static::assertEquals(RequirementCheck::STATUS_SUCCESS, $check->getStatus());
    }

    public function testEmptyNameThrowsException(): void
    {
        $this->expectException(\RuntimeException::class);
        $this->expectExceptionMessage('Empty name for RequirementCheck provided.');
        new SystemCheck('', RequirementCheck::STATUS_SUCCESS, 'installedValue', 'status');
    }

    public function testWrongStatusThrowsException(): void
    {
        
static::assertTrue($handler->wasCalled());

        /** @var ScheduledTaskEntity $task */
        $task = $this->scheduledTaskRepo->search(new Criteria([$taskId]), Context::createDefaultContext())->get($taskId);

        $newOriginalNextExecution = clone $originalNextExecution;
        $newOriginalNextExecution->modify(sprintf('+%d seconds', $interval));
        $newOriginalNextExecutionString = $newOriginalNextExecution->format(Defaults::STORAGE_DATE_TIME_FORMAT);
        $nextExecutionTimeString = $task->getNextExecutionTime()->format(Defaults::STORAGE_DATE_TIME_FORMAT);

        static::assertEquals(ScheduledTaskDefinition::STATUS_SCHEDULED, $task->getStatus());
        static::assertEquals($newOriginalNextExecutionString$nextExecutionTimeString);
        static::assertNotEquals($originalNextExecution->format(\DATE_ATOM)$task->getNextExecutionTime()->format(\DATE_ATOM));
    }

    /** * @return list<array{0: string}> */
    public static function allowedStatus(): array
    {
        return [
            [ScheduledTaskDefinition::STATUS_QUEUED],
            [

#[Package('storefront')] class StorefrontRedirectEventTest extends TestCase
{
    public function testMinimalConstructor(): void
    {
        $event = new StorefrontRedirectEvent('test_route');

        static::assertSame('test_route', $event->getRoute());
        static::assertSame([]$event->getParameters());
        static::assertSame(Response::HTTP_FOUND, $event->getStatus());
    }

    public function testConstructor(): void
    {
        $event = new StorefrontRedirectEvent('test_route', ['test_parameter' => 'test_value'], 500);

        static::assertSame('test_route', $event->getRoute());
        static::assertSame(['test_parameter' => 'test_value']$event->getParameters());
        static::assertSame(500, $event->getStatus());
    }

    
$migration = \Drupal::service('plugin.manager.migration')->createStubMigration($definition);

    $executable = new MigrateExecutable($migration);
    // When the import runs, the first row imported will trigger an     // interruption.     $result = $executable->import();

    $this->assertEquals(MigrationInterface::RESULT_INCOMPLETE, $result);

    // The status should have been reset to IDLE.     $this->assertEquals(MigrationInterface::STATUS_IDLE, $migration->getStatus());
  }

  /** * Reacts to post-row-save event. * * @param \Drupal\migrate\Event\MigratePostRowSaveEvent $event * The migration event. * @param string $name * The event name. */
  public function postRowSaveEventRecorder(MigratePostRowSaveEvent $event$name) {
    
Home | Imprint | This part of the site doesn't use cookies.