You are here

public function UpdatePublishedTest::testUpdatePublished in Acquia Content Hub 8.2

Tests entity updated status.

@dataProvider dataProvider

Parameters

mixed $args: Data.

File

tests/src/Kernel/EventSubscriber/HandleWebhook/UpdatePublishedTest.php, line 118

Class

UpdatePublishedTest
Tests entity updated published status.

Namespace

Drupal\Tests\acquia_contenthub\Kernel\EventSubscriber\HandleWebhook

Code

public function testUpdatePublished(...$args) {
  $key = new Key('id', 'secret');
  $request = Request::createFromGlobals();
  $payload = [
    'crud' => 'update',
    'status' => 'successful',
    'initiator' => $this->clientFactory
      ->getSettings()
      ->getUuid(),
    'assets' => [
      [
        'type' => $args[0],
        'uuid' => $args[1],
      ],
    ],
  ];
  $event = new HandleWebhookEvent($request, $payload, $key, $this->clientFactory
    ->getClient());
  $this->updatePublished
    ->onHandleWebhook($event);
  $entity_status = $this
    ->getStatusByUuid($args[1]);
  $this
    ->assertEqual($args[2], $entity_status);
}