PHP Classes

File: tests/failure-tests/InvalidConnectionSettingsTest.php

Recommend this page to a friend!
  Packages of Maik Greubel   Caribu ORM   tests/failure-tests/InvalidConnectionSettingsTest.php   Download  
File: tests/failure-tests/InvalidConnectionSettingsTest.php
Role: Unit test script
Content type: text/plain
Description: Unit test for invalid connection settings
Class: Caribu ORM
Map objects to databases records using annotations
Author: By
Last change: Strong type and documentation fixes
Date: 9 years ago
Size: 1,141 bytes
 

 

Contents

Class file image Download
<?php
namespace Nkey\Caribu\Tests;

require_once dirname(__FILE__).'/../AbstractDatabaseTestCase.php';
require_once dirname(__FILE__).'/../Model/MockedModel.php';

use Nkey\Caribu\Tests\Model\MockedModel;

use Nkey\Caribu\Orm\Orm;

/**
 * Complex test cases (sqlite is used)
 *
 * This class is part of Caribu package
 *
 * @author Maik Greubel <greubel@nkey.de>
 */
class InvalidConnectionSettingsTest extends AbstractDatabaseTestCase
{
    public function __construct()
    {
        parent::__construct();
        
        $this->options = array(
            'type' => 'mysql',
            'host' => 'localhost',
            'port' => 1234,
            'schema' => getenv('TEST_DATABASE') === false ? 'test' : getenv('TEST_DATABASE'),
            'user' => getenv('TEST_USER') === false ? 'test' : getenv('TEST_USER'),
            'password' => getenv('TEST_PASSWORD') === false ? '' : getenv('TEST_PASSWORD')
        );
    }

    /**
     * @expectedException Nkey\Caribu\Orm\OrmException
     */
    public function testInvalidConnection()
    {
        Orm::passivate();
        parent::setUp();
        MockedModel::find(array());
    }
}