PHP Classes

File: tests/eMapper/EnvironmentTest.php

Recommend this page to a friend!
  Classes of Emmanuel Antico   eMapper   tests/eMapper/EnvironmentTest.php   Download  
File: tests/eMapper/EnvironmentTest.php
Role: Unit test script
Content type: text/plain
Description: Unit test script
Class: eMapper
Database abstraction layer that maps data types
Author: By
Last change: Added: DynamicSQLProgram class.
Date: 9 years ago
Size: 1,311 bytes
 

Contents

Class file image Download
<?php
namespace eMapper;

use
eMapper\Dynamic\Provider\EnvironmentProvider;

/**
 * Test setting a environment instance through the EnvironmentProvider class
 * @author emaphp
 * @group environment
 */
class EnvironmentTest extends \PHPUnit_Framework_TestCase {
   
/**
     * @expectedException InvalidArgumentException
     */
   
public function testProviderError1() {
       
$environment = EnvironmentProvider::getEnvironment(1);
    }

   
/**
     * @expectedException InvalidArgumentException
     */
   
public function testProviderError2() {
       
EnvironmentProvider::buildEnvironment('fake', 'eMapper\Mapper');
    }
   
    public function
testProvider() {
       
EnvironmentProvider::buildEnvironment('default', 'eMapper\Dynamic\Environment\DynamicSQLEnvironment');
       
$this->assertTrue(EnvironmentProvider::hasEnvironment('default'));
       
$env = EnvironmentProvider::getEnvironment('default');
       
$this->assertInstanceOf('eMapper\Dynamic\Environment\DynamicSQLEnvironment', $env);
       
$this->assertTrue($env->hasPackage('Core'));
       
$this->assertTrue($env->hasPackage('Date'));
    }
   
    public function
testProvider2() {
       
EnvironmentProvider::buildEnvironment('custom', 'eMapper\Dynamic\Environment\DynamicSQLEnvironment');
       
$env = EnvironmentProvider::getEnvironment('custom');
       
$this->assertInstanceOf('eMacros\Environment\Environment', $env);
    }
}
?>