Skip to content

Commit

Permalink
Add test for case when file type could not be determined
Browse files Browse the repository at this point in the history
  • Loading branch information
bezin committed Mar 19, 2024
1 parent 40a6d66 commit e9e8081
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tests/AutoFileTemplatesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,27 @@ public function testOverwriteTemplateIfOptionIsSet(): void
$this->assertEquals('image', $service->autoAssign($image));
}

public function testFileTypeCannotBeDetermined(): void
{
$options = [
'autoAssign' => true,
];

$kirby = new App([
'roots' => [
'index' => self::$tmpDir,
],
'options' => [
'presprog.auto-file-templates' => $options,
],
]);

$service = new AutoFileTemplates($kirby, PluginOptions::createFromOptions($kirby->options()));
$image = new File(['type' => 'sometype', 'filename' => 'file', 'parent' => self::page()]);

$this->assertEquals(null, $service->autoAssign($image));
}

public static function files(): \Generator
{
$page = self::page();
Expand Down

0 comments on commit e9e8081

Please sign in to comment.