<commit_before><?php
namespace ZendTest\Db\Adapter\Driver\Pgsql;

use Zend\Db\Adapter\Driver\Pgsql\Pgsql;

class PgsqlTest extends \PHPUnit_Framework_TestCase
{

    /**
     * @var Pgsql
     */
    protected $pgsql = null;

    /**
     * Sets up the fixture, for example, opens a network connection.
     * This method is called before a test is executed.
     */
    protected function setUp()
    {
        $this->pgsql = new Pgsql(array());
    }

    /**
     * @covers Zend\Db\Adapter\Driver\Pgsql\Pgsql::checkEnvironment
     */
    public function testCheckEnvironment()
    {
        if (extension_loaded('pgsql')) {
            $this->markTestSkipped('PostgreSQL extension (pgsql) is already loaded');
        }
        $this->setExpectedException('Zend\Db\Adapter\Exception\RuntimeException');
        $this->pgsql->checkEnvironment();
    }

    /**
     * @covers Zend\Db\Adapter\Driver\Pgsql\Pgsql::registerConnection
     */
    public function testRegisterConnection()
    {
        $mockConnection = $this->getMockForAbstractClass('Zend\Db\Adapter\Driver\Pgsql\Connection', array(array()), '', true, true, true, array('setDriver'));
        $mockConnection->expects($this->once())->method('setDriver')->with($this->equalTo($this->pgsql));
        $this->assertSame($this->pgsql, $this->pgsql->registerConnection($mockConnection));
    }

    /**
     * @covers Zend\Db\Adapter\Driver\Pgsql\Pgsql::registerStatementPrototype
     */
    public function testRegisterStatementPrototype()
    {
        $this->pgsql = new Pgsql(array());
        $mockStatement = $this->getMockForAbstractClass('Zend\Db\Adapter\Driver\Pgsql\Statement', array(), '', true, true, true, array('setDriver'));
        $mockStatement->expects($this->once())->method('setDriver')->with($this->equalTo($this->pgsql));
        $this->assertSame($this->pgsql, $this->pgsql->registerStatementPrototype($mockStatement));
    }

    /**
     * @covers Zend\Db\Adapter\Driver\Pgsql\Pgsql::registerResultPrototype<commit_msg>ZendTest\Db * updated checkEnvironment() test to not be skipped for pgsql<commit_after><?php
namespace ZendTest\Db\Adapter\Driver\Pgsql;

use Zend\Db\Adapter\Driver\Pgsql\Pgsql;

class PgsqlTest extends \PHPUnit_Framework_TestCase
{

    /**
     * @var Pgsql
     */
    protected $pgsql = null;

    /**
     * Sets up the fixture, for example, opens a network connection.
     * This method is called before a test is executed.
     */
    protected function setUp()
    {
        $this->pgsql = new Pgsql(array());
    }

    /**
     * @covers Zend\Db\Adapter\Driver\Pgsql\Pgsql::checkEnvironment
     */
    public function testCheckEnvironment()
    {
        if (!extension_loaded('pgsql')) {
            $this->setExpectedException('Zend\Db\Adapter\Exception\RuntimeException');
        }
        $this->pgsql->checkEnvironment();
        $this->assertTrue(true, 'No exception was thrown');
    }

    /**
     * @covers Zend\Db\Adapter\Driver\Pgsql\Pgsql::registerConnection
     */
    public function testRegisterConnection()
    {
        $mockConnection = $this->getMockForAbstractClass('Zend\Db\Adapter\Driver\Pgsql\Connection', array(array()), '', true, true, true, array('setDriver'));
        $mockConnection->expects($this->once())->method('setDriver')->with($this->equalTo($this->pgsql));
        $this->assertSame($this->pgsql, $this->pgsql->registerConnection($mockConnection));
    }

    /**
     * @covers Zend\Db\Adapter\Driver\Pgsql\Pgsql::registerStatementPrototype
     */
    public function testRegisterStatementPrototype()
    {
        $this->pgsql = new Pgsql(array());
        $mockStatement = $this->getMockForAbstractClass('Zend\Db\Adapter\Driver\Pgsql\Statement', array(), '', true, true, true, array('setDriver'));
        $mockStatement->expects($this->once())->method('setDriver')->with($this->equalTo($this->pgsql));
        $this->assertSame($this->pgsql, $this->pgsql->registerStatementPrototype($mockStatement));
    }

    /**
     * @covers Zend\Db\Adapter\Driver\Pgsql\Pgsql::registerResultPrototype
{'fraction_non_alphanumeric': 0.15832305795314427, 'fraction_numerical': 0.0, 'mean_word_length': 3.347266881028939, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 59, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3939956', 'n_tokens_mistral': 1250, 'n_tokens_neox': 1236, 'n_words': 185}