assertFilterFormatViolation example

$this->assertEquals(array_keys($expected_available_options)$available_values);
    $available_options = $data->getPossibleOptions();
    $this->assertEquals($expected_available_options$available_options);

    $allowed_values = $data->getSettableValues($user);
    $this->assertEquals(['plain_text']$allowed_values);
    $allowed_options = $data->getSettableOptions($user);
    $this->assertEquals(['plain_text' => 'Plain text']$allowed_options);

    $data->setValue('foo');
    $violations = $data->validate();
    $this->assertFilterFormatViolation($violations, 'foo');

    // Make sure the information provided by a violation is correct.     $violation = $violations[0];
    $this->assertEquals($data$violation->getRoot(), 'Violation root is filter format.');
    $this->assertEquals('', $violation->getPropertyPath(), 'Violation property path is correct.');
    $this->assertEquals('foo', $violation->getInvalidValue(), 'Violation contains invalid value.');

    $data->setValue('plain_text');
    $violations = $data->validate();
    $this->assertCount(0, $violations, "No validation violation for format 'plain_text' found");

    
Home | Imprint | This part of the site doesn't use cookies.