mirror of
https://gh.wpcy.net/https://github.com/typisttech/image-optimize-command.git
synced 2026-05-05 21:46:52 +08:00
32 lines
845 B
PHP
32 lines
845 B
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
namespace TypistTech\ImageOptimizeCommand;
|
|
|
|
use Codeception\Test\Unit;
|
|
use Mockery;
|
|
use Spatie\ImageOptimizer\OptimizerChain;
|
|
use Spatie\ImageOptimizer\OptimizerChainFactory as BaseOptimizerChainFactory;
|
|
use WP_Mock;
|
|
|
|
class OptimizerChainFactoryTest extends Unit
|
|
{
|
|
public function testCreate()
|
|
{
|
|
$expected = BaseOptimizerChainFactory::create();
|
|
|
|
WP_Mock::userFunction(__NAMESPACE__ . '\apply_filters')
|
|
->with(
|
|
OptimizerChainFactory::HOOK,
|
|
Mockery::type(OptimizerChain::class)
|
|
)
|
|
->andReturnUsing(function ($_hook, $arg) {
|
|
return $arg;
|
|
})
|
|
->once();
|
|
|
|
$actual = OptimizerChainFactory::create();
|
|
|
|
$this->assertEquals($expected, $actual);
|
|
}
|
|
}
|