Commit 67697ed9 authored by Bernhard Schussek's avatar Bernhard Schussek

Merge branch 'bugfix/offset-strategy-null-values' into 'master'

Fixed search after/search from offset to work with NULL values

See merge request !10
parents 63449646 b9995ca6
Pipeline #19207 passed with stage
in 1 minute and 38 seconds
.composer-cache
vendor
.php_cs.cache
stages:
- test
.php:
image: dockerhub.cwd.at/docker/php/cli:7.2
before_script:
- export COMPOSER_CACHE_DIR="$(pwd -P)/crm/.composer-cache"
- mkdir -p vendor/bin
- curl -sS https://getcomposer.org/installer | php -- --install-dir=vendor/bin --filename=composer.phar && chmod 755 vendor/bin/composer.phar
- vendor/bin/composer.phar install --ansi --prefer-dist --no-progress --no-suggest
cache:
key: 'composer'
paths:
- .composer-cache/files
policy: pull-push
test:
extends: .php
script:
- export TEST_FRAMEWORK_FLAGS="--stop-on-failure"
- php -d zend.enable_gc=0 vendor/bin/phpunit -c ./phpunit.xml.dist --coverage-text --colors=never $TEST_FRAMEWORK_FLAGS
stage: test
tags: [docker]
code_analysis:
extends: .php
script:
# call php-cs-fixer but always return successful, we check the state in the next step and provide a patch file
- vendor/bin/php-cs-fixer fix --config=.php_cs --ansi --verbose --using-cache=no || true
- if [[ $(git status --porcelain 2>/dev/null | grep '[^M]' | wc -l) > 0 ]]; then git diff > cs.patch; exit 1; fi
stage: test
tags: [docker]
artifacts:
name: cs.patch
when: on_failure
expire_in: 2 days
paths:
- cs.patch
\ No newline at end of file
<?php
/*
* This file is part of the CWD Data Doctrine ORM Bundle
*
* (c) cwd.at GmbH <office@cwd.at>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Cwd\DataDoctrineORMBundle\Func\Postgresql\String;
use Doctrine\ORM\Query\AST\Functions\FunctionNode;
use Doctrine\ORM\Query\Lexer;
use Doctrine\ORM\Query\Parser;
use Doctrine\ORM\Query\SqlWalker;
/**
* Implements PosgreSQL's chr() function for DQL.
*/
class Chr extends FunctionNode
{
public $arithmeticPrimary;
/**
* {@inheritdoc}
*/
public function parse(Parser $parser)
{
$parser->match(Lexer::T_IDENTIFIER);
$parser->match(Lexer::T_OPEN_PARENTHESIS);
$this->arithmeticPrimary = $parser->ArithmeticPrimary();
$parser->match(Lexer::T_CLOSE_PARENTHESIS);
}
/**
* {@inheritdoc}
*/
public function getSql(SqlWalker $sqlWalker)
{
return sprintf(
'chr(%s)',
$this->arithmeticPrimary->dispatch($sqlWalker)
);
}
}
......@@ -100,7 +100,7 @@ abstract class OwnedValue
*
* This method copies the data of the value object into the owned value.
*
* @param null|static $ownedValue The owned value
* @param static|null $ownedValue The owned value
* @param object $value The value object
* @param object $owner The owner
*/
......@@ -147,9 +147,9 @@ abstract class OwnedValue
/**
* Extracts the value object of an owned value.
*
* @param null|OwnedValue $ownedValue The owned value. May be null
* @param OwnedValue|null $ownedValue The owned value. May be null
*
* @return null|object The value object or null
* @return object|null The value object or null
*/
public static function unwrap(?self $ownedValue)
{
......
......@@ -54,7 +54,7 @@ class CompositeFieldOffsetStrategyTest extends TestCase
public function testIsAnOffsetStrategy()
{
$this->assertTrue(is_a(CompositeFieldOffsetStrategy::class, OffsetStrategy::class));
$this->assertTrue(is_a(CompositeFieldOffsetStrategy::class, OffsetStrategy::class, true));
}
/**
......
This diff is collapsed.
......@@ -54,7 +54,7 @@ class UniqueFieldOffsetStrategyTest extends TestCase
public function testIsAnOffsetStrategy()
{
$this->assertTrue(is_a(UniqueFieldOffsetStrategy::class, OffsetStrategy::class));
$this->assertTrue(is_a(UniqueFieldOffsetStrategy::class, OffsetStrategy::class, true));
}
/**
......
......@@ -18,7 +18,6 @@ use Cwd\Common\LocalDate;
use Cwd\DataDoctrineORMBundle\Util\EmbeddableUtil;
use DateTimeImmutable;
use Generator;
use Oewm\Api\Domain\Value\Url;
use PHPUnit\Framework\TestCase;
use ReflectionClass;
......@@ -39,11 +38,6 @@ class EmbeddableUtilityTest extends TestCase
public function provideObjects(): Generator
{
yield 'initalized URL' => [
Url::createSecondary('https://foo.com'),
true,
];
yield 'initalized image' => [
new DatePeriod(
LocalDate::fromDateTime(new DateTimeImmutable('now')),
......
......@@ -15,6 +15,10 @@
}
},
"repositories": [
{
"type": "vcs",
"url": "https://gitlab.cwd.at/cwd/common.git"
},
{
"type": "vcs",
"url": "https://gitlab.cwd.at/cwd/data-bundle.git"
......@@ -25,6 +29,7 @@
"ext-pdo": "*",
"ext-pdo_mysql": "*",
"ext-pdo_pgsql": "*",
"cwd/common": "^0.2|^1.0",
"cwd/data-bundle": "^0.3|^1.0",
"symfony/dependency-injection": "^2.8|^3.0",
"symfony/http-kernel": "^2.8|^3.0",
......@@ -38,9 +43,11 @@
"doctrine/doctrine-cache-bundle": "^1.2",
"doctrine/doctrine-migrations-bundle": "^1.2",
"doctrine/orm": "^2.5",
"webmozart/assert": "^1.1"
"webmozart/assert": "^1.1",
"nikic/iter": "^1.6"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^2.13"
"friendsofphp/php-cs-fixer": "^2.13",
"phpunit/phpunit": "^7.5"
}
}
This diff is collapsed.
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/5.2/phpunit.xsd"
backupGlobals="false"
colors="true"
bootstrap="vendor/autoload.php"
failOnRisky="true"
failOnWarning="true"
>
<php>
<ini name="error_reporting" value="-1" />
</php>
<testsuites>
<testsuite name="Test Suite">
<directory>./Tests/</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory>./</directory>
<exclude>
<directory>./Tests</directory>
<directory>./vendor</directory>
</exclude>
</whitelist>
</filter>
</phpunit>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment