Nette\Config\Config & ConfigAdapterIni test #1

Load INI
object(Config) (2) {
   "production" => object(Config) (2) {
      "webname" => string(11) "the example"
      "database" => object(Config) (2) {
         "params" => object(Config) (4) {
            "host" => string(14) "db.example.com"
            "username" => string(6) "dbuser"
            "password" => string(6) "secret"
            "dbname" => string(6) "dbname"
         }
         "adapter" => string(9) "pdo_mysql"
      }
   }
   "development" => object(Config) (6) {
      "database" => object(Config) (2) {
         "params" => object(Config) (4) {
            "host" => string(15) "dev.example.com"
            "username" => string(7) "devuser"
            "password" => string(9) "devsecret"
            "dbname" => string(6) "dbname"
         }
         "adapter" => string(9) "pdo_mysql"
      }
      "timeout" => string(2) "10"
      "display_errors" => string(1) "1"
      "html_errors" => string(0) ""
      "items" => object(Config) (2) {
         "0" => string(2) "10"
         "1" => string(2) "20"
      }
      "webname" => string(11) "the example"
   }
}

toArray()
array(2) {
   "production" => array(2) {
      "webname" => string(11) "the example"
      "database" => array(2) {
         "params" => array(4) {
            "host" => string(14) "db.example.com"
            "username" => string(6) "dbuser"
            "password" => string(6) "secret"
            "dbname" => string(6) "dbname"
         }
         "adapter" => string(9) "pdo_mysql"
      }
   }
   "development" => array(6) {
      "database" => array(2) {
         "params" => array(4) {
            "host" => string(15) "dev.example.com"
            "username" => string(7) "devuser"
            "password" => string(9) "devsecret"
            "dbname" => string(6) "dbname"
         }
         "adapter" => string(9) "pdo_mysql"
      }
      "timeout" => string(2) "10"
      "display_errors" => string(1) "1"
      "html_errors" => string(0) ""
      "items" => array(2) {
         0 => string(2) "10"
         1 => string(2) "20"
      }
      "webname" => string(11) "the example"
   }
}

Save INI
; generated by Nette

[production]
webname = "the example"
database.params.host = "db.example.com"
database.params.username = "dbuser"
database.params.password = "secret"
database.params.dbname = "dbname"
database.adapter = "pdo_mysql"

[development]
database.params.host = "dev.example.com"
database.params.username = "devuser"
database.params.password = "devsecret"
database.params.dbname = "dbname"
database.adapter = "pdo_mysql"
timeout = 10
display_errors = 1
html_errors = ""
items.0 = 10
items.1 = 20
webname = "the example"

Save section to INI
; generated by Nette

[mysection]
production.webname = "the example"
production.database.params.host = "db.example.com"
production.database.params.username = "dbuser"
production.database.params.password = "secret"
production.database.params.dbname = "dbname"
production.database.adapter = "pdo_mysql"
development.database.params.host = "dev.example.com"
development.database.params.username = "devuser"
development.database.params.password = "devsecret"
development.database.params.dbname = "dbname"
development.database.adapter = "pdo_mysql"
development.timeout = 10
development.display_errors = 1
development.html_errors = ""
development.items.0 = 10
development.items.1 = 20
development.webname = "the example"

Load section from INI
object(Config) (6) {
   "database" => object(Config) (2) {
      "params" => object(Config) (4) {
         "host" => string(15) "dev.example.com"
         "username" => string(7) "devuser"
         "password" => string(9) "devsecret"
         "dbname" => string(6) "dbname"
      }
      "adapter" => string(9) "pdo_mysql"
   }
   "timeout" => string(2) "10"
   "display_errors" => string(1) "1"
   "html_errors" => string(0) ""
   "items" => object(Config) (2) {
      "0" => string(2) "10"
      "1" => string(2) "20"
   }
   "webname" => string(11) "the example"
}

Save INI
; generated by Nette

[mysection]
database.params.host = "dev.example.com"
database.params.username = "devuser"
database.params.password = "devsecret"
database.params.dbname = "dbname"
database.adapter = "pdo_mysql"
timeout = 10
display_errors = true
html_errors = false
items.0 = 10
items.1 = 20
webname = "the example"

check read-only:
InvalidStateException: Cannot modify a frozen object 'Config'.

check read-only clone:
string(10) "works good"

string(9) "pdo_mysql"

check read-only clone II:
string(10) "works good"

string(9) "pdo_mysql"