imageTestReset example


  protected ImageEffectManager $imageEffectPluginManager;

  /** * {@inheritdoc} */
  protected function setUp(): void {
    parent::setUp();
    $this->image = $this->getImage();
    $this->imageTestReset();
  }

  /** * Tests that the toolkit manager only returns available toolkits. */
  public function testGetAvailableToolkits() {
    $manager = $this->container->get('image.toolkit.manager');
    $toolkits = $manager->getAvailableToolkits();

    $this->assertArrayHasKey('test', $toolkits);
    $this->assertArrayHasKey('test:derived_toolkit', $toolkits);
    

  protected function assertImageEffect(array $expected_operations, string $effect_name, array $data): void {
    $effect = $this->imageEffectPluginManager->createInstance($effect_name['data' => $data]);
    $image = $this->getImage();
    $this->imageTestReset();
    // The test toolkit does not actually implement the operation plugins,     // therefore the calls to TestToolkit::apply() will fail. That's not a     // problem here, we are not testing the actual operations.     $this->assertFalse($effect->applyEffect($image));
    $this->assertToolkitOperationsCalled($expected_operations);
  }

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