Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 6a62913164
Fetching contributors…

Cannot retrieve contributors at this time

executable file 151 lines (134 sloc) 4.401 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151
<?php
namespace ZendTest\Db\Adapter\Driver\Oci8;

use Zend\Db\Adapter\Driver\Oci8\Oci8;
use Zend\Db\Adapter\Driver\Oci8\Connection;

/**
* @group integration
* @group integration-sqlserver
*/
class ConnectionIntegrationTest extends AbstractIntegrationTest
{
    /**
* @covers Zend\Db\Adapter\Driver\Oci8\Connection::getCurrentSchema
*/
    public function testGetCurrentSchema()
    {
        $connection = new Connection($this->variables);
        $this->assertInternalType('string', $connection->getCurrentSchema());
    }

    /**
* @covers Zend\Db\Adapter\Driver\Oci8\Connection::setResource
*/
    public function testSetResource()
    {
        $this->markTestIncomplete('edit this');
        $resource = sqlsrv_connect(
            $this->variables['hostname'], array(
                'UID' => $this->variables['username'],
                'PWD' => $this->variables['password']
            )
        );
        $connection = new Connection(array());
        $this->assertSame($connection, $connection->setResource($resource));

        $connection->disconnect();
        unset($connection);
        unset($resource);
    }

    /**
* @covers Zend\Db\Adapter\Driver\Oci8\Connection::getResource
*/
    public function testGetResource()
    {
        $connection = new Connection($this->variables);
        $connection->connect();
        $this->assertInternalType('resource', $connection->getResource());

        $connection->disconnect();
        unset($connection);
    }

    /**
* @covers Zend\Db\Adapter\Driver\Oci8\Connection::connect
*/
    public function testConnect()
    {
        $connection = new Connection($this->variables);
        $this->assertSame($connection, $connection->connect());
        $this->assertTrue($connection->isConnected());

        $connection->disconnect();
        unset($connection);
    }

    /**
* @covers Zend\Db\Adapter\Driver\Oci8\Connection::isConnected
*/
    public function testIsConnected()
    {
        $connection = new Connection($this->variables);
        $this->assertFalse($connection->isConnected());
        $this->assertSame($connection, $connection->connect());
        $this->assertTrue($connection->isConnected());

        $connection->disconnect();
        unset($connection);
    }

    /**
* @covers Zend\Db\Adapter\Driver\Oci8\Connection::disconnect
*/
    public function testDisconnect()
    {
        $connection = new Connection($this->variables);
        $connection->connect();
        $this->assertTrue($connection->isConnected());
        $connection->disconnect();
        $this->assertFalse($connection->isConnected());
    }

    /**
* @covers Zend\Db\Adapter\Driver\Oci8\Connection::beginTransaction
* @todo Implement testBeginTransaction().
*/
    public function testBeginTransaction()
    {
        // Remove the following lines when you implement this test.
        $this->markTestIncomplete(
            'This test has not been implemented yet.'
        );
    }

    /**
* @covers Zend\Db\Adapter\Driver\Oci8\Connection::commit
* @todo Implement testCommit().
*/
    public function testCommit()
    {
        // Remove the following lines when you implement this test.
        $this->markTestIncomplete(
            'This test has not been implemented yet.'
        );
    }

    /**
* @covers Zend\Db\Adapter\Driver\Oci8\Connection::rollback
* @todo Implement testRollback().
*/
    public function testRollback()
    {
        // Remove the following lines when you implement this test.
        $this->markTestIncomplete(
            'This test has not been implemented yet.'
        );
    }

    /**
* @covers Zend\Db\Adapter\Driver\Oci8\Connection::execute
*/
    public function testExecute()
    {
        $oci8 = new Oci8($this->variables);
        $connection = $oci8->getConnection();

        $result = $connection->execute('SELECT \'foo\' FROM DUAL');
        $this->assertInstanceOf('Zend\Db\Adapter\Driver\Oci8\Result', $result);
    }

    /**
* @covers Zend\Db\Adapter\Driver\Oci8\Connection::getLastGeneratedValue
*/
    public function testGetLastGeneratedValue()
    {
        $this->markTestIncomplete('Need to create a temporary sequence.');
        $connection = new Connection($this->variables);
        $connection->getLastGeneratedValue();
    }
}
Something went wrong with that request. Please try again.