Skip to content

Commit bc46b05

Browse files
authored
Merge pull request #60 from ppavlovic/release-2.x
Using g4/zf1-future-zend-db instead of the zf1/zend-db.
2 parents dd23603 + f2aecaf commit bc46b05

55 files changed

Lines changed: 208 additions & 179 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ vendor
1717

1818
tests/unit/coverage/*
1919
tests/integration/coverage/*
20+
tests/unit/.phpunit.result.cache
2021
.vagrant/
2122
.bash_history
2223
.cache/motd.legal-displayed

composer.json

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,30 +32,33 @@
3232
"G4\\DataMapper\\Test\\Integration\\": "tests/integration"
3333
}
3434
},
35+
"include-path": [
36+
"vendor/g4/zf1-future-zend-db/library/"
37+
],
3538
"require-dev": {
36-
"phpunit/phpunit" : "5.*",
37-
"phpunit/php-code-coverage" : "^3",
39+
"phpunit/phpunit" : "9.6.*",
40+
"phpunit/php-code-coverage" : "9.2.*",
3841
"squizlabs/php_codesniffer" : "3.*",
3942
"g4/code-coverage" : "1.*"
4043
},
4144
"require": {
42-
"php" : ">=5.6",
45+
"php" : ">=7.3",
4346
"ext-curl" : "*",
4447
"ext-json" : "*",
4548
"g4/factory" : "1.*",
4649
"g4/profiler" : ">=1.11.0",
4750
"g4/value-object" : ">=3.6.0",
48-
"zf1/zend-db" : "1.12.*"
51+
"g4/zf1-future-zend-db" : "1.23.*"
4952
},
5053
"scripts": {
5154
"unit-test": [
52-
"vendor/bin/phpunit -c tests/unit/phpunit.xml --colors=always --coverage-html tests/unit/coverage"
55+
"XDEBUG_MODE=coverage vendor/bin/phpunit -c tests/unit/phpunit.xml --colors=always --coverage-html tests/unit/coverage"
5356
],
5457
"test-coverage": [
55-
"./vendor/bin/phpunit --colors=always -c tests/unit/phpunit.xml --coverage-text"
58+
"XDEBUG_MODE=coverage ./vendor/bin/phpunit --colors=always -c tests/unit/phpunit.xml --coverage-text"
5659
],
5760
"test-report": [
58-
"./vendor/bin/phpunit --colors=always -c tests/unit/phpunit.xml --coverage-clover=tests/unit/coverage/code-coverage.xml"
61+
".XDEBUG_MODE=coverage /vendor/bin/phpunit --colors=always -c tests/unit/phpunit.xml --coverage-clover=tests/unit/coverage/code-coverage.xml"
5962
],
6063
"code-coverage": [
6164
"./vendor/bin/code-coverage -p 90 -f tests/unit/coverage/code-coverage.xml"

src/Engine/Elasticsearch/ElasticsearchClient.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ private function throwCurlException($code, $message, $url, $body, $response)
307307
{
308308
throw new ClientException(
309309
sprintf(
310-
"Unexpected response code:%s from ES has been returned on submit. More info: %s. Url: %s. Body: %s. Response: %s",
310+
"Unexpected response code:%s from ES has been returned on submit. More info: %s. Url: %s. Body: %s. Response: %s", // phpcs:ignore
311311
$code,
312312
json_encode($message),
313313
(string) $url,

src/Engine/Elasticsearch/Operators/ConsistentRandomKey.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,4 @@ public function format()
2727
]
2828
];
2929
}
30-
}
30+
}

src/Engine/Elasticsearch/Operators/ExistsOperator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ public function __construct($name, SingleValue $value)
2020

2121
public function format()
2222
{
23-
return [QueryConnector::EXISTS => ['field' => $this->name]];
23+
return [QueryConnector::EXISTS => ['field' => $this->name]];
2424
}
2525
}

src/Engine/Elasticsearch/Operators/LikeCIOperator.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ public function format()
2929
{
3030
return [
3131
QueryConnector::NAME_QUERY_STRING => [
32-
QueryConnector::NAME_QUERY_STRING_QUERY => $this->name . ":" . QueryConnector::ROUND_BRACKET_OPEN . QueryConnector::WILDCARD . $this->value . QueryConnector::WILDCARD . QueryConnector::ROUND_BRACKET_CLOSE
32+
QueryConnector::NAME_QUERY_STRING_QUERY =>
33+
$this->name . QueryConnector::COLON . QueryConnector::ROUND_BRACKET_OPEN . QueryConnector::WILDCARD
34+
. $this->value . QueryConnector::WILDCARD . QueryConnector::ROUND_BRACKET_CLOSE
3335
]
3436
];
3537
}

src/Engine/Elasticsearch/Version7/Operators/ConsistentRandomKey.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,4 @@ public function format()
2929
]
3030
];
3131
}
32-
}
32+
}

src/Engine/Elasticsearch/Version7/Operators/LikeCIOperator.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ public function format()
2929
{
3030
return [
3131
QueryConnector::NAME_QUERY_STRING => [
32-
QueryConnector::NAME_QUERY_STRING_QUERY => $this->name . ":" . QueryConnector::WILDCARD . strtolower($this->value) . QueryConnector::WILDCARD
32+
QueryConnector::NAME_QUERY_STRING_QUERY =>
33+
$this->name . ":" . QueryConnector::WILDCARD . strtolower($this->value) . QueryConnector::WILDCARD
3334
]
3435
];
3536
}

src/Engine/Http/HttpPath.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class HttpPath implements CollectionNameInterface
2020
* HttpPath constructor.
2121
* @param array ...$parts string
2222
*/
23-
public function __construct(... $parts)
23+
public function __construct(...$parts)
2424
{
2525
$path = join(self::SLASH, $parts);
2626

tests/unit/src/BuilderTest.php

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
<?php
22

33
use G4\DataMapper\Builder;
4+
use G4\DataMapper\Engine\MySQL\MySQLMapper;
45
use G4\DataMapper\Engine\MySQL\MySQLTableName;
56

6-
class BuilderTest extends PHPUnit_Framework_TestCase
7+
class BuilderTest extends \PHPUnit\Framework\TestCase
78
{
89

910
/**
@@ -16,8 +17,7 @@ class BuilderTest extends PHPUnit_Framework_TestCase
1617
*/
1718
private $params;
1819

19-
20-
protected function setUp()
20+
protected function setUp(): void
2121
{
2222
$this->params = [
2323
'host' => 'localhost',
@@ -29,7 +29,7 @@ protected function setUp()
2929
$this->builder = Builder::create();
3030
}
3131

32-
protected function tearDown()
32+
protected function tearDown(): void
3333
{
3434
$this->params = null;
3535
$this->builder = null;
@@ -54,7 +54,7 @@ public function testBuildMapper()
5454
$this->builder
5555
->collectionName(new MySQLTableName('profiles'))
5656
->adapter($this->getMockForMySQLAdapter());
57-
$this->builder->buildMapper();
57+
$this->assertInstanceOf(MySQLMapper::class, $this->builder->buildMapper());
5858
}
5959

6060
public function testBuildBulk()
@@ -76,7 +76,7 @@ public function testBuildWithNoAdapter()
7676

7777
public function testBuildWithNoType()
7878
{
79-
$this->builder->adapter($this->getMock('\G4\DataMapper\Common\AdapterInterface'));
79+
$this->builder->adapter($this->createMock('\G4\DataMapper\Common\AdapterInterface'));
8080
$this->expectException('\Exception');
8181
$this->expectExceptionCode(601);
8282
$this->expectExceptionMessage('DataSet cannot be emty');
@@ -86,7 +86,7 @@ public function testBuildWithNoType()
8686
public function testBuildForUnknownEngine()
8787
{
8888
$this->builder
89-
->adapter($this->getMock('\G4\DataMapper\Common\AdapterInterface'))
89+
->adapter($this->createMock('\G4\DataMapper\Common\AdapterInterface'))
9090
->collectionName(new MySQLTableName('profiles'));
9191
$this->expectException('\Exception');
9292
$this->expectExceptionCode(601);
@@ -104,12 +104,10 @@ public function testBuildTransaction()
104104

105105
private function getMockForMySQLAdapter()
106106
{
107-
return $this->getMock(
108-
'\G4\DataMapper\Engine\MySQL\MySQLAdapter',
109-
null,
110-
[
111-
$this->getMock('\G4\DataMapper\Engine\MySQL\MySQLClientFactory', null, [$this->params]),
112-
]
113-
);
107+
return $this->getMockBuilder('\G4\DataMapper\Engine\MySQL\MySQLAdapter')
108+
->setConstructorArgs([
109+
$this->createMock('\G4\DataMapper\Engine\MySQL\MySQLClientFactory'),
110+
])
111+
->getMock();
114112
}
115113
}

0 commit comments

Comments
 (0)