Skip to content

Commit

Permalink
Add ImageManager::driver()
Browse files Browse the repository at this point in the history
  • Loading branch information
olivervogel committed Apr 13, 2024
1 parent 6e104b6 commit 2691d92
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/ImageManager.php
Expand Up @@ -124,6 +124,16 @@ public function animate(callable $init): ImageInterface
return $this->driver->createAnimation($init);
}

/**
* Return currently used driver
*
* @return DriverInterface
*/
public function driver(): DriverInterface
{
return $this->driver;
}

/**
* Return driver object
*
Expand Down
7 changes: 7 additions & 0 deletions tests/Unit/ImageManagerTest.php
Expand Up @@ -35,6 +35,13 @@ public function testWithDriver(): void
$this->assertInstanceOf(ImageManager::class, $manager);
}

public function testDriver(): void
{
$driver = new GdDriver();
$manager = ImageManager::withDriver($driver);
$this->assertEquals($driver, $manager->driver());
}

public function testDriverStatics(): void
{
$manager = ImageManager::gd();
Expand Down

0 comments on commit 2691d92

Please sign in to comment.