Issues (57)

test/integration/Connection/ConnectionTest.php (1 issue)

1
<?php
2
declare(strict_types = 1);
3
4
namespace TBolier\RethinkQL\IntegrationTest\Connection;
5
6
use Mockery;
7
use Mockery\MockInterface;
8
use TBolier\RethinkQL\Connection\ConnectionInterface;
9
use TBolier\RethinkQL\Connection\OptionsInterface;
10
use TBolier\RethinkQL\IntegrationTest\AbstractTestCase;
11
use TBolier\RethinkQL\Response\ResponseInterface;
12
use TBolier\RethinkQL\Types\Query\QueryType;
13
14
class ConnectionTest extends AbstractTestCase
15
{
16
    /**
17
     * @var MockInterface
18
     */
19
    private $optionsMock;
20
21
    public function setUp()
22
    {
23
        parent::setUp();
24
25
        $this->optionsMock = Mockery::mock(OptionsInterface::class);
26
    }
27
28
    /**
29
     * @throws \Exception
30
     */
31
    public function testConnect()
32
    {
33
        /** @var ConnectionInterface $connection */
34
        $connection = $this->createConnection('phpunit_default')->connect();
35
        $result = $connection->expr('foo');
36
37
        $this->assertInstanceOf(ResponseInterface::class, $result);
38
        $this->assertEquals('foo', $result->getData());
39
    }
40
41
    /**
42
     * @throws \Exception
43
     */
44
    public function testServer()
45
    {
46
        /** @var ConnectionInterface $connection */
47
        $res = $this->createConnection('phpunit_default')->connect()->server();
48
49
        $this->assertEquals(QueryType::SERVER_INFO, $res->getType());
50
        $this->assertInternalType('string', $res->getData()['name']);
0 ignored issues
show
Deprecated Code introduced by
The function PHPUnit\Framework\Assert::assertInternalType() has been deprecated: https://github.com/sebastianbergmann/phpunit/issues/3369 ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

50
        /** @scrutinizer ignore-deprecated */ $this->assertInternalType('string', $res->getData()['name']);

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
51
    }
52
}
53