reset() public static method

Resets the Environment class to its default state, including unsetting the current environment, removing any environment-specific configurations, and removing the custom environment detector, if any has been specified.
public static reset ( $env = null )
$env If set, delete the defined environment only.
Example #1
0
 /**
  * Tests resetting the `Environment` class to its default state.
  *
  * @return void
  */
 public function testReset()
 {
     Environment::set('test', array('foo' => 'bar'));
     Environment::set('test');
     $this->assertEqual('test', Environment::get());
     $this->assertEqual('bar', Environment::get('foo'));
     Environment::reset();
     $this->assertEqual('', Environment::get());
     $this->assertNull(Environment::get('foo'));
 }
Example #2
0
 public function testResetASpecificEnv()
 {
     Environment::set('test', array('foo' => 'bar'));
     Environment::set('development', array('hello' => 'world'));
     Environment::set('test');
     $this->assertEqual('test', Environment::get());
     $this->assertEqual('bar', Environment::get('foo'));
     Environment::reset('test');
     $this->assertEqual('test', Environment::get());
     $this->assertNull(Environment::get('foo'));
     Environment::set('development');
     $this->assertEqual('world', Environment::get('hello'));
 }