Skip to content

Commit b296ddf

Browse files
committed
Add test for null source validation in TextFileLoader
1 parent fd6fdee commit b296ddf

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/store/tests/Document/Loader/TextFileLoaderTest.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,22 @@
1515
use PHPUnit\Framework\TestCase;
1616
use Symfony\AI\Store\Document\Loader\TextFileLoader;
1717
use Symfony\AI\Store\Document\TextDocument;
18+
use Symfony\AI\Store\Exception\InvalidArgumentException;
1819
use Symfony\AI\Store\Exception\RuntimeException;
1920

2021
#[CoversClass(TextFileLoader::class)]
2122
final class TextFileLoaderTest extends TestCase
2223
{
24+
public function testLoadWithNullSource()
25+
{
26+
$loader = new TextFileLoader();
27+
28+
$this->expectException(InvalidArgumentException::class);
29+
$this->expectExceptionMessage('TextFileLoader requires a file path as source, null given.');
30+
31+
iterator_to_array($loader->load(null));
32+
}
33+
2334
public function testLoadWithInvalidSource()
2435
{
2536
$loader = new TextFileLoader();

0 commit comments

Comments
 (0)