|
@@ 127-143 (lines=17) @@
|
| 124 |
|
/** |
| 125 |
|
* @test |
| 126 |
|
*/ |
| 127 |
|
public function canWriteModifiedYamlToFileSystem() |
| 128 |
|
{ |
| 129 |
|
$originalHash = md5_file('src/Tests/Functional/PetStore/app/swagger/petstore.yml'); |
| 130 |
|
vfsStreamWrapper::register(); |
| 131 |
|
vfsStreamWrapper::setRoot(new vfsStreamDirectory('canWriteModifiedYamlToFileSystem')); |
| 132 |
|
|
| 133 |
|
$modifiedPath = vfsStream::url('canWriteModifiedYamlToFileSystem/modified.yml'); |
| 134 |
|
|
| 135 |
|
$document = self::getPetStoreDocument(); |
| 136 |
|
$definition = $document->getDefinition(); |
| 137 |
|
$definition->version = '0.0.2'; |
| 138 |
|
$document->write($modifiedPath); |
| 139 |
|
|
| 140 |
|
$newHash = md5_file($modifiedPath); |
| 141 |
|
|
| 142 |
|
$this->assertNotSame($originalHash, $newHash); |
| 143 |
|
} |
| 144 |
|
|
| 145 |
|
/** |
| 146 |
|
* @test |
|
@@ 148-164 (lines=17) @@
|
| 145 |
|
/** |
| 146 |
|
* @test |
| 147 |
|
*/ |
| 148 |
|
public function canModifiedYamlWrittenToFileSystemHandlesEmptyArraysCorrectly() |
| 149 |
|
{ |
| 150 |
|
vfsStreamWrapper::register(); |
| 151 |
|
vfsStreamWrapper::setRoot( |
| 152 |
|
new vfsStreamDirectory('canModifiedYamlWrittenToFileSystemHandlesEmptyArraysCorrectly') |
| 153 |
|
); |
| 154 |
|
|
| 155 |
|
$modifiedPath = vfsStream::url('canModifiedYamlWrittenToFileSystemHandlesEmptyArraysCorrectly/modified.yml'); |
| 156 |
|
|
| 157 |
|
$document = self::getPetStoreDocument(); |
| 158 |
|
$definition = $document->getDefinition(); |
| 159 |
|
$definition->version = '0.0.2'; |
| 160 |
|
$document->write($modifiedPath); |
| 161 |
|
|
| 162 |
|
$content = file_get_contents($modifiedPath); |
| 163 |
|
$this->assertNotRegExp('/\: \{ \}/', $content); |
| 164 |
|
} |
| 165 |
|
|
| 166 |
|
/** |
| 167 |
|
* @test |