Exemplo n.º 1
0
 public function testGet()
 {
     $this->assertTrue(Env::get('TEST_TRUE'));
     $this->assertFalse(Env::get('NOT_SET', false));
     $this->assertSame('test', Env::get('NOT_SET2', function () {
         return 'test';
     }));
     $this->assertFalse(Env::get('TEST_FALSE'));
     $this->assertFalse(Env::get('TEST_FALSE_2'));
     $this->assertSame(null, Env::get('TEST_NULL'));
     $this->assertSame(25, Env::get('TEST_NUM'));
     $this->assertSame('', Env::get('TEST_EMPTY'));
     $this->assertSame('teststring', Env::get('TEST_NORMAL'));
     $this->assertSame('teststring', Env::get('TEST_QUOTES'));
 }
Exemplo n.º 2
0
 /**
  * Gets the value of an environment variable. Supports boolean, empty and null.
  *
  * @param string $key
  * @param mixed  $default
  *
  * @return mixed
  */
 function env(string $key, $default = null)
 {
     return Env::get($key, $default);
 }