I need to add dependencies to test cases in my extension, which is based on the ext-template repository, but nothing I have tried has worked. The following test runs as expected:
However, adding Log to the constructor does not work:
Is it possible? If so, how?
PHP Code:
<?php declare(strict_types=1);
namespace tests\unit\Espo\Modules\MoreDateFilters;
use PHPUnit\Framework\TestCase;
class CoreTest extends TestCase
{
public function __construct() {
parent::__construct();
}
public function testGetWeekStartEnd_date(): void {
$this->assertTrue(true);
}
}
PHP Code:
...
use Espo\Core\Utils\Log;
...
public function __construct(
private Log $log,
) {
parent::__construct();
}
...
Code:
PHP Fatal error: ... Too few arguments ... 0 passed in ... and exactly 1 expected in ...
Comment