Commit 28ed37eb authored by Pavel's avatar Pavel
Browse files

Merge branch 'feature_query' into 'main'

Feature query

See merge request piligrimov/search-es!2
parents ec78f088 e7c1d4c0
Loading
Loading
Loading
Loading

.env.example

0 → 100644
+4 −0
Original line number Diff line number Diff line
IQ_ES_HOSTS=127.0.0.1:9200
IQ_ES_USER=
IQ_ES_PASSWORD=
IQ_ES_PRODUCT_SEARCH_INDEX=
 No newline at end of file
+3 −1
Original line number Diff line number Diff line
@@ -2,3 +2,5 @@
/composer.lock
/vendor/
/.idea/
.env
.phpunit.result.cache
 No newline at end of file
+13 −1
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@
  "require": {
    "php": ">=7.4",
    "ramsey/collection": "^1.2",
    "iqdev/search-dc": "1.1.*",
    "iqdev/search-dc": "1.2.*",
    "elasticsearch/elasticsearch": "^8.5",
    "vlucas/phpdotenv": "^5.4.1"
  },
@@ -27,12 +27,24 @@
      "IQDEV\\ElasticSearch\\": "src/ElasticSearch/"
    }
  },
  "autoload-dev": {
    "psr-4": {
      "IQDEV\\ElasticSearchTests\\": "tests/"
    }
  },
  "repositories": [
    {
      "type": "vcs",
      "url": "ssh://git@gitlab.iqdev.digital:8422/piligrimov/search-dc.git"
    }
  ],
  "require-dev": {
    "phpunit/phpunit": "^9.5",
    "symfony/var-dumper": "^5.4"
  },
  "scripts": {
    "tests": "php ./vendor/bin/phpunit --testdox --verbose"
  },
  "config": {
    "allow-plugins": {
      "php-http/discovery": true

phpunit.xml.dist

0 → 100644
+21 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="UTF-8"?>

<phpunit colors="true" 
         convertErrorsToExceptions="true" 
         convertNoticesToExceptions="true"
         convertWarningsToExceptions="true" 
         processIsolation="false" 
         stopOnFailure="false"
         bootstrap="tests/bootstrap.php">
    <testsuites>
        <testsuite name="Project Tests Suite">
            <directory>tests</directory>
        </testsuite>
    </testsuites>

    <coverage processUncoveredFiles="true">
        <include>
            <directory suffix=".php">src/ElasticSearch/</directory>
        </include>
    </coverage>
</phpunit>
 No newline at end of file

readme.md

0 → 100644
+24 −0
Original line number Diff line number Diff line
# Проведение тестов
Для работы корректности фильтрации и индексации данных в эластике необходимо подключение к elasticsearch

## Индексация elasticsearch
Эластик поднимается и настраивается отдельно.

Настроить подключение к эластику в переменных окружения .env

```dotenv
IQ_ES_HOSTS=http://127.0.0.1:9200
IQ_ES_USER=elastic
IQ_ES_PASSWORD=passsword
IQ_ES_PRODUCT_SEARCH_INDEX=product-test
```

Для наполнения эластика данными выполнить команду:

`php tests/CLI/DefaultSeed.php`

## Запуск тестов

Для проведения тестов можно использовать команду

`php composer tests`
 No newline at end of file
Loading