Hi,
Im currently trying to mock files of a (mocked) page. For my unit tests I currently use a setup with real pages, I would like to replace that with mocks.
Mocking pages works, but I have problems with mocking files for a page. I tried the page factory like so:
$outbox = File::factory([
'parent' => kirby()->page(),
'filename' => 'a-test.json',
'content' => ['test']
]);
which results in an error:
Exception: The property “parent” is required
I just tried around with some other examples I found in the forum:
File::factory([
'parent' => kirby()->user(),
'filename' => 'test',
]);
resulting in the same message.
The docs (File::factory() | Kirby CMS) do not give a lot more information other than that it has to be set in the props. So I thought I did that right.
Obviousely I am not can somebody tell me what’s wrong here?
Thanks
Maurice