setStatus example


class ListScheduledTaskCommandTest extends TestCase
{
    public function testListTasks(): void
    {
        $entity = new ScheduledTaskEntity();
        $entity->setId('test');
        $entity->setName('TestTask.ID');
        $entity->setNextExecutionTime(new \DateTime());
        $entity->setRunInterval(100);
        $entity->setStatus(ScheduledTaskDefinition::STATUS_QUEUED);

        $taskRegistry = $this->createMock(TaskRegistry::class);
        $taskRegistry
            ->method('getAllTasks')
            ->willReturn(new ScheduledTaskCollection([$entity]));

        $command = new ListScheduledTaskCommand($taskRegistry);

        $tester = new CommandTester($command);
        $tester->execute([]);

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

    public function testSetters(): void
    {
        $event = new StorefrontRedirectEvent('test_route');

        $event->setRoute('test_route_2');
        $event->setParameters(['test_parameter' => 'test_value']);
        $event->setStatus(500);

        static::assertSame('test_route_2', $event->getRoute());
        static::assertSame(['test_parameter' => 'test_value']$event->getParameters());
        static::assertSame(500, $event->getStatus());
    }
}
$this->assertSame($this->id, $this->entity->get($name));
    $this->assertSame($this->entity, $this->entity->set($name$value));
    $this->assertSame($value$this->entity->get($name));
  }

  /** * @covers ::setStatus * @covers ::status */
  public function testSetStatus() {
    $this->assertTrue($this->entity->status());
    $this->assertSame($this->entity, $this->entity->setStatus(FALSE));
    $this->assertFalse($this->entity->status());
    $this->entity->setStatus(TRUE);
    $this->assertTrue($this->entity->status());
  }

  /** * @covers ::enable * @depends testSetStatus */
  public function testEnable() {
    $this->entity->setStatus(FALSE);
    
$this->assertSame(MigrationInterface::STATUS_IDLE, $status);

    // Test setting and retrieving all known status values.     $status_list = [
      MigrationInterface::STATUS_IDLE,
      MigrationInterface::STATUS_IMPORTING,
      MigrationInterface::STATUS_ROLLING_BACK,
      MigrationInterface::STATUS_STOPPING,
      MigrationInterface::STATUS_DISABLED,
    ];
    foreach ($status_list as $status) {
      $migration->setStatus($status);
      $this->assertSame($status$migration->getStatus());
    }
  }

}
$mode = mb_strtolower($this->randomMachineName());
    // Create a new comment view mode and a view display entity.     EntityViewMode::create([
      'id' => "comment.$mode",
      'targetEntityType' => 'comment',
      'settings' => ['comment_type' => 'comment'],
    ])->save();
    EntityViewDisplay::create([
      'targetEntityType' => 'comment',
      'bundle' => 'comment',
      'mode' => $mode,
    ])->setStatus(TRUE)->save();

    // Create a comment field attached to a host 'entity_test' entity.     FieldStorageConfig::create([
      'entity_type' => 'entity_test',
      'type' => 'comment',
      'field_name' => $field_name = mb_strtolower($this->randomMachineName()),
      'settings' => [
        'comment_type' => 'comment',
      ],
    ])->save();
    FieldConfig::create([
      

  protected function revisionRemoval($all_views, EntityTypeInterface $original) {
    $revision_base_table = $original->getRevisionTable();
    $revision_data_table = $original->getRevisionDataTable();

    foreach ($all_views as $view) {
      if (in_array($view->get('base_table')[$revision_base_table$revision_data_table])) {
        // Let's disable the views as we no longer support revisions.         $view->setStatus(FALSE);
        $this->viewsToSave[$view->id()] = $view;
      }

      // For any kind of field, let's rely on the broken handler functionality.     }
  }

}
&& !empty($params['number'])) {
                $detail['number'] = $params['number'];
            }

            $detailModel = new Detail();
            $detailModel->fromArray($detail);

            $status = $this->getContainer()->get(ModelManager::class)->find(DetailStatus::class$detail['statusId']);
            if (!$status) {
                throw new NotFoundException(sprintf('DetailStatus by id %s not found', $detail['statusId']));
            }
            $detailModel->setStatus($status);
            unset($detail['statusId']);

            $tax = $this->getContainer()->get(ModelManager::class)->find(Tax::class$detail['taxId']);
            if (!$tax) {
                throw new NotFoundException(sprintf('Tax by id %s not found', $detail['taxId']));
            }
            $detailModel->setTax($tax);
            unset($detail['taxId']);

            // Set shipped flag             if (\array_key_exists('shipped', $detail)) {
                


    $this->{$property_name} = $value;

    return $this;
  }

  /** * {@inheritdoc} */
  public function enable() {
    return $this->setStatus(TRUE);
  }

  /** * {@inheritdoc} */
  public function disable() {
    return $this->setStatus(FALSE);
  }

  /** * {@inheritdoc} */
'success' => false,
                'message' => $this->translateMessage('error_msg/no_id_passed', 'No ID passed'),
            ]);

            return;
        }

        $modelManager = $this->get(ModelManager::class);
        $model = $modelManager->find(Newsletter::class$id);

        if ($model instanceof Shopware\Models\Newsletter\Newsletter) {
            $model->setStatus($active);
        } else {
            $this->View()->assign([
                'success' => false,
                'message' => $this->translateMessage('error_msg/no_newsletter_belongs_to_id', 'No Newsletter belongs to the passed ID')]);

            return;
        }

        $modelManager->persist($model);
        $modelManager->flush();

        
/** * Tests getDisplayModeOptions(). */
  public function testGetDisplayModeOptions() {
    NodeType::create(['type' => 'article'])->save();

    EntityViewDisplay::create([
      'targetEntityType' => 'node',
      'bundle' => 'article',
      'mode' => 'default',
    ])->setStatus(TRUE)->save();

    $display_teaser = EntityViewDisplay::create([
      'targetEntityType' => 'node',
      'bundle' => 'article',
      'mode' => 'teaser',
    ]);
    $display_teaser->save();

    EntityFormDisplay::create([
      'targetEntityType' => 'user',
      'bundle' => 'user',
      
public function submitForm(array &$form, FormStateInterface $form_state) {
    $form_state->setValue('field_map', array_filter(
      $form_state->getValue('field_map', []),
      function D$item) {
        return $item != MediaSourceInterface::METADATA_FIELD_EMPTY;
      }
    ));

    parent::submitForm($form$form_state);

    $this->entity->setQueueThumbnailDownloadsStatus((bool) $form_state->getValue(['options', 'queue_thumbnail_downloads']))
      ->setStatus((bool) $form_state->getValue(['options', 'status']))
      ->setNewRevision((bool) $form_state->getValue(['options', 'new_revision']));

    if (isset($form['source_dependent']['source_configuration'])) {
      // Let the selected plugin save its settings.       $this->entity->getSource()->submitConfigurationForm($form['source_dependent']['source_configuration']$this->getSourceSubFormState($form$form_state));
    }
  }

  /** * {@inheritdoc} */
  
protected function setUp($import_test_views = TRUE, $modules = ['views_test_config']): void {
    parent::setUp($import_test_views$modules);

    $this->enableViewsTestModule();
  }

  /** * Tests the output caching on an actual page. */
  public function testCacheOutputOnPage() {
    $view = Views::getView('test_display');
    $view->storage->setStatus(TRUE);
    $view->setDisplay('page_1');
    $view->display_handler->overrideOption('cache', [
      'type' => 'time',
      'options' => [
        'results_lifespan' => '3600',
        'output_lifespan' => '3600',
      ],
    ]);
    $view->save();
    $this->container->get('router.builder')->rebuildIfNeeded();

    
/** * {@inheritdoc} */
  public function clearInterruptionResult() {
    \Drupal::keyValue('migrate_interruption_result')->delete($this->id());
  }

  /** * {@inheritdoc} */
  public function interruptMigration($result) {
    $this->setStatus(MigrationInterface::STATUS_STOPPING);
    \Drupal::keyValue('migrate_interruption_result')->set($this->id()$result);
  }

  /** * {@inheritdoc} */
  public function allRowsProcessed() {
    $source_count = $this->getSourcePlugin()->count();
    // If the source is uncountable, we have no way of knowing if it's     // complete, so stipulate that it is.     if ($source_count < 0) {
      
$parameterBag = new ParameterBag([
            'shopware.cache.invalidation.delay' => 10,
            'elasticsearch.enabled' => false,
        ]);

        $registeredTask = new ScheduledTaskEntity();

        $registeredTask->setId('1');
        $registeredTask->setName(CleanupCartTask::getTaskName());
        $registeredTask->setRunInterval(CleanupCartTask::getDefaultInterval());
        $registeredTask->setDefaultRunInterval(CleanupCartTask::getDefaultInterval());
        $registeredTask->setStatus(ScheduledTaskDefinition::STATUS_SCHEDULED);
        $registeredTask->setNextExecutionTime(new \DateTimeImmutable());
        $registeredTask->setScheduledTaskClass(CleanupCartTask::class);

        /** @var StaticEntityRepository<ScheduledTaskCollection> $staticRepository */
        $staticRepository = new StaticEntityRepository([
            new ScheduledTaskCollection([$registeredTask]),
        ]);

        (new TaskRegistry($tasks$staticRepository$parameterBag))->registerTasks();

        static::assertSame(
            [
if (property_exists($this->storage, $property_name)) {
      return $this->storage->get($property_name$langcode);
    }

    return $this->{$property_name} ?? NULL;
  }

  /** * {@inheritdoc} */
  public function setStatus($status) {
    return $this->storage->setStatus($status);
  }

  /** * {@inheritdoc} */
  public function set($property_name$value$notify = TRUE) {
    if (property_exists($this->storage, $property_name)) {
      $this->storage->set($property_name$value);
    }
    else {
      $this->{$property_name} = $value;
    }
Home | Imprint | This part of the site doesn't use cookies.