Skip to content

Commit 20aff87

Browse files
committed
Test if recursive folder creating works for the XmlFeatureAdapter
1 parent 33844e6 commit 20aff87

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

tests/Adapters/XmlFeatureAdapterTest.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,28 @@ public function it_can_write_a_changelog()
4343
unlink($path);
4444
}
4545

46+
/** @test */
47+
public function it_creates_the_directory_recursively_if_it_does_not_exist()
48+
{
49+
$adapter = $this->adapter();
50+
$feature = new Feature([
51+
new Change('added', 'Added a new feature.'),
52+
]);
53+
$folderA = __DIR__.'/../test-data/write-test/nested';
54+
$folderB = $folderA.'/second-child';
55+
$path = $folderB.'/example.xml';
56+
57+
$adapter->write($path, $feature);
58+
59+
$contents = file_get_contents($path);
60+
61+
$this->assertStringContainsString('<change type="added">Added a new feature.</change>', $contents);
62+
63+
unlink($path);
64+
rmdir($folderB);
65+
rmdir($folderA);
66+
}
67+
4668
/** @test */
4769
public function it_throws_an_exception_when_the_file_is_invalid()
4870
{

0 commit comments

Comments
 (0)