Example #1
0
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 * This software consists of voluntary contributions made by many individuals
 * and is licensed under the MIT license.
 */
use ZfrCorsTest\Util\ServiceManagerFactory;
ini_set('error_reporting', E_ALL);
$files = array(__DIR__ . '/../vendor/autoload.php', __DIR__ . '/../../../autoload.php');
foreach ($files as $file) {
    if (file_exists($file)) {
        $loader = (require $file);
        break;
    }
}
if (!isset($loader)) {
    throw new RuntimeException('vendor/autoload.php could not be found. Did you install via composer?');
}
$loader->add('ZfrCorsTest\\', __DIR__);
$configFiles = array(__DIR__ . '/TestConfiguration.php', __DIR__ . '/TestConfiguration.php.dist');
foreach ($configFiles as $configFile) {
    if (file_exists($configFile)) {
        $config = (require $configFile);
        break;
    }
}
ServiceManagerFactory::setApplicationConfig($config);
unset($files, $file, $loader, $configFiles, $configFile, $config);
 public function testCanCreateCorsRequestListener()
 {
     $serviceManager = ServiceManagerFactory::getServiceManager();
     $listener = $serviceManager->get('ZfrCors\\Mvc\\CorsRequestListener');
     $this->assertInstanceOf('ZfrCors\\Mvc\\CorsRequestListener', $listener);
 }
 public function testCanCreateOptions()
 {
     $serviceManager = ServiceManagerFactory::getServiceManager();
     $options = $serviceManager->get('ZfrCors\\Options\\CorsOptions');
     $this->assertInstanceOf('ZfrCors\\Options\\CorsOptions', $options);
 }
 public function testCanCreateCorsService()
 {
     $serviceManager = ServiceManagerFactory::getServiceManager();
     $service = $serviceManager->get('ZfrCors\\Service\\CorsService');
     $this->assertInstanceOf('ZfrCors\\Service\\CorsService', $service);
 }