Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Jan 29, 2020. It is now read-only.

Commit 1cf0b93

Browse files
committed
zendframework/zendframework#6730 zendframework/zendframework#6761 - config reader should disallow opening non existing files
1 parent 06264ca commit 1cf0b93

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

test/Reader/XmlTest.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
/**
1616
* @group Zend_Config
17+
*
18+
* @covers \Zend\Config\Reader\Xml
1719
*/
1820
class XmlTest extends AbstractReaderTestCase
1921
{
@@ -123,6 +125,28 @@ public function testElementWithBothAttributesAndAStringValueIsProcessedCorrectly
123125
$this->assertEquals('bazbat', $arrayXml['one'][1]['_']);
124126
}
125127

128+
/**
129+
* @group 6761
130+
* @group 6730
131+
*/
132+
public function testReadRemovedFilesWillFailWithException()
133+
{
134+
$configReader = new Xml();
135+
136+
$asset = $this->getTestAssetPath('attributes');
137+
$tmpAssetPath = tempnam(sys_get_temp_dir(), 'attributesTestAsset');
138+
139+
copy($asset, $tmpAssetPath);
140+
141+
$configReader->fromFile($tmpAssetPath);
142+
143+
unlink($tmpAssetPath);
144+
145+
$this->setExpectedException('Zend\Config\Exception\RuntimeException');
146+
147+
$configReader->fromFile($tmpAssetPath);
148+
}
149+
126150
/**
127151
* @group 6761
128152
* @group 6730

0 commit comments

Comments
 (0)