Ejemplo n.º 1
0
     });
 });
 describe("->set()", function () {
     it("sets values on the config array", function () {
         $config = new Repository($this->config);
         $config->set('a', ['b', 'c']);
         $config->set('d.e', 'f');
         $config->set('z.y.x', ['w', 'u']);
         $array = $config->all();
         expect($array['a'])->toBe(['b', 'c']);
         expect($array['d']['e'])->toBe('f');
         expect($array['z']['y']['x'])->toBe(['w', 'u']);
     });
     it("overwrites the config array if the key is null", function () {
         $config = new Repository($this->config);
         $config->set(null, ['foo', 'bar']);
         $array = $config->all();
         expect($array)->toBe(['foo', 'bar']);
     });
 });
 describe("->get()", function () {
     it("returns a value from the array", function () {
         $config = new Repository($this->config);
         expect($config->get('database'))->toBe($this->config['database']);
     });
     it("returns the value of a multi dimensional array using dot notation", function () {
         $config = new Repository($this->config);
         expect($config->get('database.mysql'))->toBe($this->config['database']['mysql']);
         expect($config->get('database.mysql.host'))->toBe($this->config['database']['mysql']['host']);
     });
 });