<?php
namespace Tests\Unit;

use \Dotenv;
/**
 * Dotenv Test
 * 
 * @author Leonid Mamchenkov <l.mamchenkov@qobo.biz>
 */
class DotenvTest extends \PHPUnit_Framework_TestCase {

	protected $folder;
	protected $file;

	protected function setUp() {
		$this->folder = __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR;
		$this->file = '.env.example';
	}

	/**
	 * Check that the file exists
	 */
	public function testDotenvExampleFileExists() {
		$this->assertTrue(file_exists($this->folder . $this->file), $this->file . " file does not exist in " . $this->folder);
	}

	/**
	* Check that we can parse the file
	*/
	public function testDotenvExampleFileIsParseable() {
		try {
			Dotenv::load($this->folder, $this->file);
		}
		catch (\Exception $e) {
			$this->fail("Failed to parse file " . $this->file . " in " . $this->folder . " : " . $e->getMessage());
		}
	}
}

<?php
namespace Tests\Unit;

use \Dotenv;
/**
 * Dotenv Test
 * 
 * @author Leonid Mamchenkov <l.mamchenkov@qobo.biz>
 */
class DotenvTest extends \PHPUnit_Framework_TestCase {

	/**
	 * Provide .env file locations
	 */
	public function dotEnvFilesProvider() {
		return array(
			'.env.example' => array(__DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR, '.env.example'),
			'.env'         => array(__DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR, '.env'),
		);
	}

	/**
	 * Check that the file exists
	 * 
	 * @dataProvider dotEnvFilesProvider
	 */
	public function testDotenvExampleFileExists($folder, $file) {
		$this->assertTrue(file_exists($folder . $file), $file . " file does not exist in " . $folder);
	}

	/**
	 * Check that we can parse the file
	 * 
	 * @dataProvider dotEnvFilesProvider
	 */
	public function testDotenvExampleFileIsParseable($folder, $file) {
		try {
			Dotenv::load($folder, $file);
		}
		catch (\Exception $e) {
			$this->fail("Failed to parse file " . $file . " in " . $folder . " : " . $e->getMessage());
		}
	}
}

Check that .env file was generate as part of install
Check that .env file was generate as part of install
