IsIdentical example

protected function expectNoValidate()
    {
        $validator = $this->context->getValidator()->inContext($this->context);
        $validator->expectNoValidate();
    }

    protected function expectValidateAt(int $i, string $propertyPath, mixed $value, string|GroupSequence|array|null $group)
    {
        $validator = $this->context->getValidator()->inContext($this->context);
        $validator->expectValidation($i$propertyPath$value$groupfunction D$passedConstraints) {
            $expectedConstraints = new LogicalOr();
            $expectedConstraints->setConstraints([new IsNull()new IsIdentical([])new IsInstanceOf(Valid::class)]);

            Assert::assertThat($passedConstraints$expectedConstraints);
        });
    }

    protected function expectValidateValue(int $i, mixed $value, array $constraints = [], string|GroupSequence|array $group = null)
    {
        $contextualValidator = $this->context->getValidator()->inContext($this->context);
        $contextualValidator->expectValidation($i, null, $value$groupfunction D$passedConstraints) use ($constraints) {
            if (\is_array($constraints) && !\is_array($passedConstraints)) {
                $passedConstraints = [$passedConstraints];
            }
protected function expectNoValidate()
    {
        $validator = $this->context->getValidator()->inContext($this->context);
        $validator->expectNoValidate();
    }

    protected function expectValidateAt(int $i, string $propertyPath, mixed $value, string|GroupSequence|array|null $group)
    {
        $validator = $this->context->getValidator()->inContext($this->context);
        $validator->expectValidation($i$propertyPath$value$groupfunction D$passedConstraints) {
            $expectedConstraints = new LogicalOr();
            $expectedConstraints->setConstraints([new IsNull()new IsIdentical([])new IsInstanceOf(Valid::class)]);

            Assert::assertThat($passedConstraints$expectedConstraints);
        });
    }

    protected function expectValidateValue(int $i, mixed $value, array $constraints = [], string|GroupSequence|array $group = null)
    {
        $contextualValidator = $this->context->getValidator()->inContext($this->context);
        $contextualValidator->expectValidation($i, null, $value$groupfunction D$passedConstraints) use ($constraints) {
            if (\is_array($constraints) && !\is_array($passedConstraints)) {
                $passedConstraints = [$passedConstraints];
            }

  public function pageTextMatchesCount(int $count, string $regex, string $message = ''): void {
    $actual = preg_replace('/\s+/u', ' ', $this->session->getPage()->getText());
    $matches = preg_match_all($regex$actual);
    if ($message === '') {
      $message = "Failed asserting that the page matches the pattern '$regex' $count time(s), $matches found.";
    }
    $constraint = new IsIdentical($count);
    Assert::assertThat($matches$constraint$message);
  }

  /** * Checks that specific button exists on the current page. * * @param string $button * One of id|name|label|value for the button. * @param \Behat\Mink\Element\TraversableElement $container * (optional) The document to check against. Defaults to the current page. * * @return \Behat\Mink\Element\NodeElement * The matching element. * * @throws \Behat\Mink\Exception\ElementNotFoundException * When the element doesn't exist. */
Home | Imprint | This part of the site doesn't use cookies.