<?php

namespace Buckhill;

use function Buckhill\config;

class ConfigTest extends \PhpUnit_Framework_TestCase
{
    public function testGet()
    {
        $my_arr = [
            'test' => [
                'another' => [
                    'nested' => 'value'
                ]
            ]
        ];

        config($my_arr);

        $this->assertTrue(is_array(config('test.another')));
        $this->assertEquals('value', config('test.another.nested'));
    }

    public function testSet()
    {
        $this->assertInstanceOf('Buckhill\\Configuration', config()->set('section', ['value' => 'lorem']));
        $this->assertTrue(is_array(config('section')));
        $this->assertEquals('lorem', config('section.value'));
    }

    public function testRetrieve()
    {
    }

    public function testGetNonexistent()
    {
        config([]);

        $this->assertNull(null, config('nonexistent.key'));
    }
}