Jarves\Tests\Configuration\BundleConfigTest::testFileImportSaveObjects PHP Method

testFileImportSaveObjects() public method

    public function testFileImportSaveObjects()
    {
        $configs = new Configs($this->getJarves());
        $this->setupFiles();
        $bundle = new TestsFileImportBundle();
        $configStrings = $configs->getXmlConfigsForBundle($bundle);
        $configObjects = $configs->parseConfig($configStrings);
        $testBundleConfig = $configObjects['testsfileimport'];
        $this->assertNotNull($testBundleConfig);
        $export = $testBundleConfig->exportFileBased('objects');
        $this->assertStringEqualsFile($this->getJarvesObjectsXmlFile(), $export, 'no changes');
        $objects = $testBundleConfig->getObjects();
        current($objects)->setId('TestChanged');
        $testBundleConfig->setObjects($objects);
        $this->getConfigurationOperator()->saveFileBased($testBundleConfig, 'objects');
        $xml = '<config>
  <bundle>
    <objects>
      <object id="TestChanged">
        <label>Test</label>
        <storageService>tests.store.core.test</storageService>
        <fields>
          <field id="id" type="number" primaryKey="true">
            <label>ID</label>
          </field>
          <field id="name" type="text">
            <label>Name</label>
          </field>
        </fields>
      </object>
    </objects>
  </bundle>
</config>';
        $this->assertEquals(static::$jarvesObjectsXml, $testBundleConfig->getPropertyFilePath('objects'));
        $this->assertStringEqualsFile($this->getRoot() . $testBundleConfig->getPropertyFilePath('objects'), $xml);
        $this->removeFiles();
    }