Assert whether all servers are at a particular state.

@param string $event
@param int    $expected

@return bool
175251
public function allServerAre($event, $expected)
    {
        $targets = $this->computeNumberOfTargets();
        $statuses = array_filter($this->statuses[$event], function ($server) use ($expected) {
            return $server === $expected;
        });

        return $targets === count($statuses);
    }
812185
public function assertWorkflowTransitions(TableNode $expected) {
    $states_info = [];
    foreach ($this->getWorkflows() as $workflow) {

      /** @var \Drupal\workflows\TransitionInterface[] $transitions */
      $transitions = $workflow->getTypePlugin()->getTransitions();
      foreach ($transitions as $transition) {
        foreach ($transition->from() as $from_state) {

          $states_info[] = [
            $workflow->label(),
            $transition->label(),
            $transition->id(),
            $from_state->label(),
            $transition->to()->label(),
          ];
        }

      }
    }
    $actual = new TableNode($states_info);

    (new TableEqualityAssertion($expected, $actual))
      ->expectHeader([
        'Workflow',
        'Label',
        'Machine name',
        'From state',
        'To state',
      ])
      ->ignoreRowOrder()
      ->setMissingRowsLabel(self::missingRowsLabelFor('workflow states'))
      ->setUnexpectedRowsLabel(self::unexpectedRowsLabelFor('workflow states'))
      ->assert();
  }
98052
public function seeInEmailSubject($expected)
    {
        $email = $this->fetchLastMessage();
        $this->assertContains($expected, $email->subject, 'Email subject contains text');
    }
1329499
static function isArrayEqual($expected, $actual) {

		if (Arrays::isNumeric($actual) and Arrays::isNumeric($expected)) {
			sort($expected);
			sort($actual);
		} else {
			asort($expected);
			asort($actual);
		}

		return $expected == $actual;
	}
647036
public function assertNotSame($expected, $message = '')
    {
        Assert::assertNotSame($expected, $this->getData(), $message);

        return $this;
    }
1075978
protected function assertEquals($expected, $actual, $message = '', $delta = 0.0)
    {
        \PHPUnit\Framework\Assert::assertEquals($expected, $actual, $message, $delta);
    }
538303
private function requestHeadersMatchExpectation(ServerRequestInterface $httpRequest, Request $expectedRequest)
    {
        foreach ($expectedRequest->getHeaders() as $header => $headerCondition) {
            $inputSource = $this->inputSourceFactory->createFromConfig([
                'header' => $header,
            ]);
            $matcher = $this->matcherFactory->createFromConfig([
                $headerCondition->getMatcher() => $headerCondition->getValue(),
            ]);

            if (!$this->evaluate($inputSource, $matcher, $httpRequest)) {
                return false;
            }
        }

        return true;
    }
1111225
public function eventTriggered($event)
    {
        $event = $this->normalizeEvent($event);

        foreach ($this->triggeredEvents as $triggeredEvent) {
            if ($event == $triggeredEvent || is_subclass_of($event, $triggeredEvent)) {
                return true;
            }
        }

        return false;
    }
302273
public static function checkAnyOrder(...$events): ?EventCollection
    {
        $container = self::$globals::$container;

        return $container->eventOrderVerifier->checkAnyOrder(...$events);
    }
151406
private function requestHeadersMatchExpectation(ServerRequestInterface $httpRequest, RequestConditions $expectedRequest)
    {
        $inputSource = $this->inputSourceLocator->locate('header');
        foreach ($expectedRequest->getHeaders() as $header => $headerCondition) {
            $matcher = $this->matcherLocator->locate(
                $headerCondition->getMatcher()->asString()
            );

            $matches = $matcher->match(
                $inputSource->getValue($httpRequest, $header->asString()),
                $headerCondition->getValue()->asString()
            );
            if (!$matches) {
                return false;
            }
        }

        return true;
    }
206465
public function checkAnyOrder(...$events): ?EventCollection
    {
        if (!count($events)) {
            return null;
        }

        return $this->assertionRecorder
            ->createSuccess($this->mergeEvents($events));
    }
1220588
public function equals($expected): bool
    {
        if (!is_scalar($expected) && null != $expected) {
            throw new \InvalidArgumentException(
                    'Can only compare scalar values and null.'
            );
        }

        return $expected === $this->value;
    }
70465
public function match(Event $event) : bool
    {
        $filter = $this->filter;
        if (!$filter) {
            return true;
        }
        if (is_string($filter)){
            return $this->matchEventName($filter, $event);
        }
        if (is_callable($filter)){
            return ($filter)($event);
        }
        return false;
    }
1144209
boolean awaitState(final InternalState expected) {
        synchronized (this) {
            final InternalState initialRequired = this.requiredState;
            for(;;) {
                final InternalState required = this.requiredState;
                // Stop in case the server failed to reach the state
                if(required == InternalState.FAILED) {
                    return false;
                // Stop in case the required state changed
                } else if (initialRequired != required) {
                    return false;
                }
                final InternalState current = this.internalState;
                if(expected == current) {
                    return true;
                }
                try {
                    wait();
                } catch(InterruptedException e) {
                    Thread.currentThread().interrupt();
                    return false;
                }
            }
        }
    }
27224
public function has($event)
    {
        list($event, $payload) = $this->parseEventAndPayload($event, []);

        return array_key_exists($event, $this->listeners);
    }
229710
protected function runSingleServerEvent($event)
    {
        if ($this->schedule->serverShouldRun($event, $this->startedAt)) {
            $this->runEvent($event);
        } else {
            $this->line('<info>Skipping command (has already run on another server):</info> '.$event->getSummaryForDisplay());
        }
    }
1217017
public function isMatch(Event $event)
    {
        if (is_callable($this->checker)) {
            return call_user_func($this->checker, $event);
        }
        return false;
    }