assertToolkitOperationsCalled example

/** * 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);
    $this->assertArrayNotHasKey('broken', $toolkits);
    $this->assertToolkitOperationsCalled([]);
  }

  /** * Tests Image's methods. */
  public function testLoad() {
    $image = $this->getImage();
    $this->assertInstanceOf(ImageInterface::class$image);
    $this->assertEquals('test', $image->getToolkitId());
    $this->assertToolkitOperationsCalled(['parseFile']);
  }

  

  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.