mirror of
https://github.com/Intervention/image.git
synced 2025-08-22 13:32:56 +02:00
Add tests, improve code
This commit is contained in:
@@ -16,9 +16,9 @@ final class ConfigTest extends BaseTestCase
|
||||
$config = new Config();
|
||||
$this->assertInstanceOf(Config::class, $config);
|
||||
|
||||
$this->assertTrue($config->option('autoOrientation'));
|
||||
$this->assertTrue($config->option('decodeAnimation'));
|
||||
$this->assertEquals('ffffff00', $config->option('blendingColor'));
|
||||
$this->assertTrue($config->autoOrientation);
|
||||
$this->assertTrue($config->decodeAnimation);
|
||||
$this->assertEquals('ffffff', $config->blendingColor);
|
||||
|
||||
$config = new Config(
|
||||
autoOrientation: false,
|
||||
@@ -27,17 +27,17 @@ final class ConfigTest extends BaseTestCase
|
||||
);
|
||||
$this->assertInstanceOf(Config::class, $config);
|
||||
|
||||
$this->assertFalse($config->option('autoOrientation'));
|
||||
$this->assertFalse($config->option('decodeAnimation'));
|
||||
$this->assertEquals('f00', $config->option('blendingColor'));
|
||||
$this->assertFalse($config->autoOrientation);
|
||||
$this->assertFalse($config->decodeAnimation);
|
||||
$this->assertEquals('f00', $config->blendingColor);
|
||||
}
|
||||
|
||||
public function testGetSetOptions(): void
|
||||
{
|
||||
$config = new Config();
|
||||
$this->assertTrue($config->option('autoOrientation'));
|
||||
$this->assertTrue($config->option('decodeAnimation'));
|
||||
$this->assertEquals('ffffff00', $config->option('blendingColor'));
|
||||
$this->assertTrue($config->autoOrientation);
|
||||
$this->assertTrue($config->decodeAnimation);
|
||||
$this->assertEquals('ffffff', $config->blendingColor);
|
||||
|
||||
$result = $config->setOptions(
|
||||
autoOrientation: false,
|
||||
@@ -45,25 +45,22 @@ final class ConfigTest extends BaseTestCase
|
||||
blendingColor: 'f00',
|
||||
);
|
||||
|
||||
$this->assertFalse($config->option('autoOrientation'));
|
||||
$this->assertFalse($config->option('decodeAnimation'));
|
||||
$this->assertEquals('f00', $config->option('blendingColor'));
|
||||
$this->assertFalse($config->autoOrientation);
|
||||
$this->assertFalse($config->decodeAnimation);
|
||||
$this->assertEquals('f00', $config->blendingColor);
|
||||
|
||||
$this->assertFalse($result->option('autoOrientation'));
|
||||
$this->assertFalse($result->option('decodeAnimation'));
|
||||
$this->assertEquals('f00', $result->option('blendingColor'));
|
||||
$this->assertFalse($result->autoOrientation);
|
||||
$this->assertFalse($result->decodeAnimation);
|
||||
$this->assertEquals('f00', $result->blendingColor);
|
||||
|
||||
$result = $config->setOption('blendingColor', '000');
|
||||
|
||||
$this->assertFalse($config->option('autoOrientation'));
|
||||
$this->assertFalse($config->option('decodeAnimation'));
|
||||
$this->assertEquals('000', $config->option('blendingColor'));
|
||||
$this->assertFalse($config->autoOrientation);
|
||||
$this->assertFalse($config->decodeAnimation);
|
||||
$this->assertEquals('000', $config->blendingColor);
|
||||
|
||||
$this->assertFalse($result->option('autoOrientation'));
|
||||
$this->assertFalse($result->option('decodeAnimation'));
|
||||
$this->assertEquals('000', $result->option('blendingColor'));
|
||||
|
||||
$this->assertNull($config->option('unknown'));
|
||||
$this->assertEquals('test', $config->option('unknown', 'test'));
|
||||
$this->assertFalse($result->autoOrientation);
|
||||
$this->assertFalse($result->decodeAnimation);
|
||||
$this->assertEquals('000', $result->blendingColor);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user