From 507d17425780bc611b356b4bfb30b0162dfe3fba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois-Xavier=20de=20Guillebon?= Date: Fri, 4 Dec 2020 15:50:25 +0100 Subject: [PATCH] Deprecate unsuffixed processor classes --- src/Processor/Append.php | 38 +------- src/Processor/AppendProcessor.php | 45 +++++++++ src/Processor/Attachment.php | 66 +------------ src/Processor/AttachmentProcessor.php | 72 ++++++++++++++ src/Processor/Convert.php | 58 +----------- src/Processor/ConvertProcessor.php | 64 +++++++++++++ src/Processor/Date.php | 67 +------------ src/Processor/DateIndexName.php | 88 +---------------- src/Processor/DateIndexNameProcessor.php | 94 +++++++++++++++++++ src/Processor/DateProcessor.php | 73 ++++++++++++++ ...AppendTest.php => AppendProcessorTest.php} | 10 +- ...ntTest.php => AttachmentProcessorTest.php} | 16 ++-- ...nvertTest.php => ConvertProcessorTest.php} | 10 +- ...est.php => DateIndexNameProcessorTest.php} | 8 +- .../{DateTest.php => DateProcessorTest.php} | 12 +-- 15 files changed, 396 insertions(+), 325 deletions(-) create mode 100644 src/Processor/AppendProcessor.php create mode 100644 src/Processor/AttachmentProcessor.php create mode 100644 src/Processor/ConvertProcessor.php create mode 100644 src/Processor/DateIndexNameProcessor.php create mode 100644 src/Processor/DateProcessor.php rename tests/Processor/{AppendTest.php => AppendProcessorTest.php} (86%) rename tests/Processor/{AttachmentTest.php => AttachmentProcessorTest.php} (93%) rename tests/Processor/{ConvertTest.php => ConvertProcessorTest.php} (89%) rename tests/Processor/{DateIndexNameTest.php => DateIndexNameProcessorTest.php} (84%) rename tests/Processor/{DateTest.php => DateProcessorTest.php} (83%) diff --git a/src/Processor/Append.php b/src/Processor/Append.php index 54f0c74ea5..beb229ad1b 100644 --- a/src/Processor/Append.php +++ b/src/Processor/Append.php @@ -2,46 +2,16 @@ namespace Elastica\Processor; +trigger_deprecation('ruflin/elastica', '7.1.0', 'The "%s" class is deprecated, use "%s" instead. It will be removed in 8.0.', Append::class, AppendProcessor::class); + /** * Elastica Append Processor. * * @author Federico Panini * * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/append-processor.html + * @deprecated since version 7.1.0, use the AppendProcessor class instead. */ -class Append extends AbstractProcessor +class Append extends AppendProcessor { - /** - * Append constructor. - * - * @param string $field field name - * @param array|string $value field values to append - */ - public function __construct(string $field, $value) - { - $this->setField($field); - $this->setValue($value); - } - - /** - * Set field. - * - * @return $this - */ - public function setField(string $field): self - { - return $this->setParam('field', $field); - } - - /** - * Set field value. - * - * @param array|string $value - * - * @return $this - */ - public function setValue($value): self - { - return $this->setParam('value', $value); - } } diff --git a/src/Processor/AppendProcessor.php b/src/Processor/AppendProcessor.php new file mode 100644 index 0000000000..006989db4e --- /dev/null +++ b/src/Processor/AppendProcessor.php @@ -0,0 +1,45 @@ + + * + * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/append-processor.html + */ +class AppendProcessor extends AbstractProcessor +{ + /** + * @param string $field field name + * @param array|string $value field values to append + */ + public function __construct(string $field, $value) + { + $this->setField($field); + $this->setValue($value); + } + + /** + * Set field. + * + * @return $this + */ + public function setField(string $field): self + { + return $this->setParam('field', $field); + } + + /** + * Set field value. + * + * @param array|string $value + * + * @return $this + */ + public function setValue($value): self + { + return $this->setParam('value', $value); + } +} diff --git a/src/Processor/Attachment.php b/src/Processor/Attachment.php index 146f11b685..0916f26fbb 100644 --- a/src/Processor/Attachment.php +++ b/src/Processor/Attachment.php @@ -2,74 +2,16 @@ namespace Elastica\Processor; +trigger_deprecation('ruflin/elastica', '7.1.0', 'The "%s" class is deprecated, use "%s" instead. It will be removed in 8.0.', Attachment::class, AttachmentProcessor::class); + /** * Elastica Attachment Processor. * * @author Federico Panini * * @see https://www.elastic.co/guide/en/elasticsearch/plugins/current/ingest-attachment.html + * @deprecated since version 7.1.0, use the AttachmentProcessor class instead. */ -class Attachment extends AbstractProcessor +class Attachment extends AttachmentProcessor { - public const DEFAULT_TARGET_FIELD_VALUE = 'attachment'; - public const DEFAULT_INDEXED_CHARS_VALUE = 100000; - public const DEFAULT_IGNORE_MISSING_VALUE = false; - - /** - * Attachment constructor. - */ - public function __construct(string $field) - { - $this->setField($field); - } - - /** - * Set field. - * - * @return $this - */ - public function setField(string $field): self - { - return $this->setParam('field', $field); - } - - /** - * Set target_field. Default attachment. - * - * @return $this - */ - public function setTargetField(string $targetField): self - { - return $this->setParam('target_field', $targetField); - } - - /** - * Set indexed_chars. Default 100000. - * - * @return $this - */ - public function setIndexedChars(int $indexedChars): self - { - return $this->setParam('indexed_chars', $indexedChars); - } - - /** - * Set properties. Default all properties. Can be content, title, name, author, keywords, date, content_type, content_length, language. - * - * @return $this - */ - public function setProperties(array $properties): self - { - return $this->setParam('properties', $properties); - } - - /** - * Set ignore_missing. Default value false. - * - * @return $this - */ - public function setIgnoreMissing(bool $ignoreMissing): self - { - return $this->setParam('ignore_missing', $ignoreMissing); - } } diff --git a/src/Processor/AttachmentProcessor.php b/src/Processor/AttachmentProcessor.php new file mode 100644 index 0000000000..8ae4c94bad --- /dev/null +++ b/src/Processor/AttachmentProcessor.php @@ -0,0 +1,72 @@ + + * + * @see https://www.elastic.co/guide/en/elasticsearch/plugins/current/ingest-attachment.html + */ +class AttachmentProcessor extends AbstractProcessor +{ + public const DEFAULT_TARGET_FIELD_VALUE = 'attachment'; + public const DEFAULT_INDEXED_CHARS_VALUE = 100000; + public const DEFAULT_IGNORE_MISSING_VALUE = false; + + public function __construct(string $field) + { + $this->setField($field); + } + + /** + * Set field. + * + * @return $this + */ + public function setField(string $field): self + { + return $this->setParam('field', $field); + } + + /** + * Set target_field. Default attachment. + * + * @return $this + */ + public function setTargetField(string $targetField): self + { + return $this->setParam('target_field', $targetField); + } + + /** + * Set indexed_chars. Default 100000. + * + * @return $this + */ + public function setIndexedChars(int $indexedChars): self + { + return $this->setParam('indexed_chars', $indexedChars); + } + + /** + * Set properties. Default all properties. Can be content, title, name, author, keywords, date, content_type, content_length, language. + * + * @return $this + */ + public function setProperties(array $properties): self + { + return $this->setParam('properties', $properties); + } + + /** + * Set ignore_missing. Default value false. + * + * @return $this + */ + public function setIgnoreMissing(bool $ignoreMissing): self + { + return $this->setParam('ignore_missing', $ignoreMissing); + } +} diff --git a/src/Processor/Convert.php b/src/Processor/Convert.php index 5328eafbfb..54d98e13bc 100644 --- a/src/Processor/Convert.php +++ b/src/Processor/Convert.php @@ -2,66 +2,16 @@ namespace Elastica\Processor; +trigger_deprecation('ruflin/elastica', '7.1.0', 'The "%s" class is deprecated, use "%s" instead. It will be removed in 8.0.', Convert::class, ConvertProcessor::class); + /** * Elastica Convert Processor. * * @author Federico Panini * * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/convert-processor.html + * @deprecated since version 7.1.0, use the ConvertProcessor class instead. */ -class Convert extends AbstractProcessor +class Convert extends ConvertProcessor { - public const DEFAULT_TARGET_FIELD_VALUE = 'field'; - public const DEFAULT_IGNORE_MISSING_VALUE = false; - - /** - * Convert constructor. - */ - public function __construct(string $field, string $type) - { - $this->setField($field); - $this->setType($type); - } - - /** - * Set field. - * - * @return $this - */ - public function setField(string $field): self - { - return $this->setParam('field', $field); - } - - /** - * Set field value. - * - * @return $this - */ - public function setType(string $type): self - { - return $this->setParam('type', $type); - } - - /** - * Set target_field. Default value field. - * - * @return $this - */ - public function setTargetField(string $targetField): self - { - return $this->setParam('target_field', $targetField); - } - - /** - * Set ignore_missing. Default value false. - * - * @param bool $ignoreMissing only these values are allowed (integer|float|string|boolean|auto) - * - * @return $this - */ - public function setIgnoreMissing(bool $ignoreMissing): self - { - return $this->setParam('ignore_missing', $ignoreMissing); - } } diff --git a/src/Processor/ConvertProcessor.php b/src/Processor/ConvertProcessor.php new file mode 100644 index 0000000000..e50ba65e76 --- /dev/null +++ b/src/Processor/ConvertProcessor.php @@ -0,0 +1,64 @@ + + * + * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/convert-processor.html + */ +class ConvertProcessor extends AbstractProcessor +{ + public const DEFAULT_TARGET_FIELD_VALUE = 'field'; + public const DEFAULT_IGNORE_MISSING_VALUE = false; + + public function __construct(string $field, string $type) + { + $this->setField($field); + $this->setType($type); + } + + /** + * Set field. + * + * @return $this + */ + public function setField(string $field): self + { + return $this->setParam('field', $field); + } + + /** + * Set field value. + * + * @return $this + */ + public function setType(string $type): self + { + return $this->setParam('type', $type); + } + + /** + * Set target_field. Default value field. + * + * @return $this + */ + public function setTargetField(string $targetField): self + { + return $this->setParam('target_field', $targetField); + } + + /** + * Set ignore_missing. Default value false. + * + * @param bool $ignoreMissing only these values are allowed (integer|float|string|boolean|auto) + * + * @return $this + */ + public function setIgnoreMissing(bool $ignoreMissing): self + { + return $this->setParam('ignore_missing', $ignoreMissing); + } +} diff --git a/src/Processor/Date.php b/src/Processor/Date.php index 2c8d265d9c..9b35c17f8a 100644 --- a/src/Processor/Date.php +++ b/src/Processor/Date.php @@ -2,75 +2,16 @@ namespace Elastica\Processor; +trigger_deprecation('ruflin/elastica', '7.1.0', 'The "%s" class is deprecated, use "%s" instead. It will be removed in 8.0.', Date::class, DateProcessor::class); + /** * Elastica Date Processor. * * @author Federico Panini * * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/date-processor.html + * @deprecated since version 7.1.0, use the DateProcessor class instead. */ -class Date extends AbstractProcessor +class Date extends DateProcessor { - public const DEFAULT_TARGET_FIELD_VALUE = '@timestamp'; - public const DEFAULT_TIMEZONE_VALUE = 'UTC'; - public const DEFAULT_LOCALE_VALUE = 'ENGLISH'; - - /** - * Date constructor. - */ - public function __construct(string $field, array $formats) - { - $this->setField($field); - $this->setFormats($formats); - } - - /** - * Set field. - * - * @return $this - */ - public function setField(string $field): self - { - return $this->setParam('field', $field); - } - - /** - * Set field format. Joda pattern or one of the following formats ISO8601, UNIX, UNIX_MS, or TAI64N. - * - * @return $this - */ - public function setFormats(array $formats): self - { - return $this->setParam('formats', $formats); - } - - /** - * Set target_field. Default value @timestamp. - * - * @return $this - */ - public function setTargetField(string $targetField): self - { - return $this->setParam('target_field', $targetField); - } - - /** - * Set the timezone use when parsing the date. Default UTC. - * - * @return $this - */ - public function setTimezone(string $timezone): self - { - return $this->setParam('timezone', $timezone); - } - - /** - * Set the locale to use when parsing the date. - * - * @return $this - */ - public function setLocale(string $locale): self - { - return $this->setParam('locale', $locale); - } } diff --git a/src/Processor/DateIndexName.php b/src/Processor/DateIndexName.php index 43f7e982cf..05a2236cc5 100644 --- a/src/Processor/DateIndexName.php +++ b/src/Processor/DateIndexName.php @@ -2,96 +2,16 @@ namespace Elastica\Processor; +trigger_deprecation('ruflin/elastica', '7.1.0', 'The "%s" class is deprecated, use "%s" instead. It will be removed in 8.0.', DateIndexName::class, DateIndexNameProcessor::class); + /** * Elastica DateIndexName Processor. * * @author Federico Panini * * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/date-index-name-processor.html + * @deprecated since version 7.1.0, use the DateIndexNameProcessor class instead. */ -class DateIndexName extends AbstractProcessor +class DateIndexName extends DateIndexNameProcessor { - public const DEFAULT_DATE_FORMATS_VALUE = ['ISO8601']; - public const DEFAULT_INDEX_NAME_FORMAT_VALUE = 'yyyy-MM-dd'; - public const DEFAULT_TIMEZONE_VALUE = 'UTC'; - public const DEFAULT_LOCALE_VALUE = 'ENGLISH'; - - /** - * DateIndexName constructor. - */ - public function __construct(string $field, string $dateRounding) - { - $this->setField($field); - $this->setDateRounding($dateRounding); - } - - /** - * Set field. - * - * @return $this - */ - public function setField(string $field): self - { - return $this->setParam('field', $field); - } - - /** - * Set date_rounding. Valid values are: y (year), M (month), w (week), d (day), h (hour), m (minute) and s (second). - * - * @return $this - */ - public function setDateRounding(string $dateRounding): self - { - return $this->setParam('date_rounding', $dateRounding); - } - - /** - * Set field formats. Joda pattern or one of the following formats ISO8601, UNIX, UNIX_MS, or TAI64N. - * - * @return $this - */ - public function setDateFormats(array $formats): self - { - return $this->setParam('date_formats', $formats); - } - - /** - * Set index_prefix_name. - * - * @return $this - */ - public function setIndexNamePrefix(string $indexPrefixName): self - { - return $this->setParam('index_name_prefix', $indexPrefixName); - } - - /** - * Set format to be used when printing parsed date. An valid Joda pattern is expected here. Default yyyy-MM-dd. - * - * @return $this - */ - public function setIndexNameFormat(string $indexNameFormat): self - { - return $this->setParam('index_name_format', $indexNameFormat); - } - - /** - * Set the timezone use when parsing the date. Default UTC. - * - * @return $this - */ - public function setTimezone(string $timezone): self - { - return $this->setParam('timezone', $timezone); - } - - /** - * Set the locale to use when parsing the date. - * - * @return $this - */ - public function setLocale(string $locale): self - { - return $this->setParam('locale', $locale); - } } diff --git a/src/Processor/DateIndexNameProcessor.php b/src/Processor/DateIndexNameProcessor.php new file mode 100644 index 0000000000..82c520135d --- /dev/null +++ b/src/Processor/DateIndexNameProcessor.php @@ -0,0 +1,94 @@ + + * + * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/date-index-name-processor.html + */ +class DateIndexNameProcessor extends AbstractProcessor +{ + public const DEFAULT_DATE_FORMATS_VALUE = ['ISO8601']; + public const DEFAULT_INDEX_NAME_FORMAT_VALUE = 'yyyy-MM-dd'; + public const DEFAULT_TIMEZONE_VALUE = 'UTC'; + public const DEFAULT_LOCALE_VALUE = 'ENGLISH'; + + public function __construct(string $field, string $dateRounding) + { + $this->setField($field); + $this->setDateRounding($dateRounding); + } + + /** + * Set field. + * + * @return $this + */ + public function setField(string $field): self + { + return $this->setParam('field', $field); + } + + /** + * Set date_rounding. Valid values are: y (year), M (month), w (week), d (day), h (hour), m (minute) and s (second). + * + * @return $this + */ + public function setDateRounding(string $dateRounding): self + { + return $this->setParam('date_rounding', $dateRounding); + } + + /** + * Set field formats. Joda pattern or one of the following formats ISO8601, UNIX, UNIX_MS, or TAI64N. + * + * @return $this + */ + public function setDateFormats(array $formats): self + { + return $this->setParam('date_formats', $formats); + } + + /** + * Set index_prefix_name. + * + * @return $this + */ + public function setIndexNamePrefix(string $indexPrefixName): self + { + return $this->setParam('index_name_prefix', $indexPrefixName); + } + + /** + * Set format to be used when printing parsed date. An valid Joda pattern is expected here. Default yyyy-MM-dd. + * + * @return $this + */ + public function setIndexNameFormat(string $indexNameFormat): self + { + return $this->setParam('index_name_format', $indexNameFormat); + } + + /** + * Set the timezone use when parsing the date. Default UTC. + * + * @return $this + */ + public function setTimezone(string $timezone): self + { + return $this->setParam('timezone', $timezone); + } + + /** + * Set the locale to use when parsing the date. + * + * @return $this + */ + public function setLocale(string $locale): self + { + return $this->setParam('locale', $locale); + } +} diff --git a/src/Processor/DateProcessor.php b/src/Processor/DateProcessor.php new file mode 100644 index 0000000000..8574a6b499 --- /dev/null +++ b/src/Processor/DateProcessor.php @@ -0,0 +1,73 @@ + + * + * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/date-processor.html + */ +class DateProcessor extends AbstractProcessor +{ + public const DEFAULT_TARGET_FIELD_VALUE = '@timestamp'; + public const DEFAULT_TIMEZONE_VALUE = 'UTC'; + public const DEFAULT_LOCALE_VALUE = 'ENGLISH'; + + public function __construct(string $field, array $formats) + { + $this->setField($field); + $this->setFormats($formats); + } + + /** + * Set field. + * + * @return $this + */ + public function setField(string $field): self + { + return $this->setParam('field', $field); + } + + /** + * Set field format. Joda pattern or one of the following formats ISO8601, UNIX, UNIX_MS, or TAI64N. + * + * @return $this + */ + public function setFormats(array $formats): self + { + return $this->setParam('formats', $formats); + } + + /** + * Set target_field. Default value @timestamp. + * + * @return $this + */ + public function setTargetField(string $targetField): self + { + return $this->setParam('target_field', $targetField); + } + + /** + * Set the timezone use when parsing the date. Default UTC. + * + * @return $this + */ + public function setTimezone(string $timezone): self + { + return $this->setParam('timezone', $timezone); + } + + /** + * Set the locale to use when parsing the date. + * + * @return $this + */ + public function setLocale(string $locale): self + { + return $this->setParam('locale', $locale); + } +} diff --git a/tests/Processor/AppendTest.php b/tests/Processor/AppendProcessorTest.php similarity index 86% rename from tests/Processor/AppendTest.php rename to tests/Processor/AppendProcessorTest.php index d182819df7..5cb18761f3 100644 --- a/tests/Processor/AppendTest.php +++ b/tests/Processor/AppendProcessorTest.php @@ -4,20 +4,20 @@ use Elastica\Bulk; use Elastica\Document; -use Elastica\Processor\Append; +use Elastica\Processor\AppendProcessor; use Elastica\Test\BasePipeline as BasePipelineTest; /** * @internal */ -class AppendTest extends BasePipelineTest +class AppendProcessorTest extends BasePipelineTest { /** * @group unit */ public function testAppendSingleValue(): void { - $processor = new Append('field1', 'item2'); + $processor = new AppendProcessor('field1', 'item2'); $expected = [ 'append' => [ @@ -34,7 +34,7 @@ public function testAppendSingleValue(): void */ public function testAppendArray(): void { - $processor = new Append('field1', ['item2', 'item3', 'item4']); + $processor = new AppendProcessor('field1', ['item2', 'item3', 'item4']); $expected = [ 'append' => [ @@ -51,7 +51,7 @@ public function testAppendArray(): void */ public function testAppend(): void { - $append = new Append('foo', ['item2', 'item3', 'item4']); + $append = new AppendProcessor('foo', ['item2', 'item3', 'item4']); $pipeline = $this->_createPipeline('my_custom_pipeline', 'pipeline for Append'); $pipeline->addProcessor($append)->create(); diff --git a/tests/Processor/AttachmentTest.php b/tests/Processor/AttachmentProcessorTest.php similarity index 93% rename from tests/Processor/AttachmentTest.php rename to tests/Processor/AttachmentProcessorTest.php index 26a800441d..0c408c3282 100644 --- a/tests/Processor/AttachmentTest.php +++ b/tests/Processor/AttachmentProcessorTest.php @@ -5,20 +5,20 @@ use Elastica\Bulk; use Elastica\Document; use Elastica\Mapping; -use Elastica\Processor\Attachment; +use Elastica\Processor\AttachmentProcessor; use Elastica\Test\BasePipeline as BasePipelineTest; /** * @internal */ -class AttachmentTest extends BasePipelineTest +class AttachmentProcessorTest extends BasePipelineTest { /** * @group unit */ public function testAttachment(): void { - $processor = new Attachment('data'); + $processor = new AttachmentProcessor('data'); $expected = [ 'attachment' => [ @@ -34,7 +34,7 @@ public function testAttachment(): void */ public function testAttachmentWithNonDefaultOptions(): void { - $processor = new Attachment('data'); + $processor = new AttachmentProcessor('data'); $processor->setIndexedChars(1000); $processor->setProperties(['content', 'title', 'language']); $processor->setTargetField('attachment-new-name'); @@ -58,7 +58,7 @@ public function testAttachmentWithNonDefaultOptions(): void */ public function testAttachmentAddPdf(): void { - $attachment = new Attachment('data'); + $attachment = new AttachmentProcessor('data'); $pipeline = $this->_createPipeline('my_custom_pipeline_attachment', 'pipeline for Attachment'); $pipeline->addProcessor($attachment); $pipeline->create(); @@ -100,7 +100,7 @@ public function testAttachmentAddPdf(): void */ public function testAttachmentAddPdfFileContent(): void { - $attachment = new Attachment('data'); + $attachment = new AttachmentProcessor('data'); $pipeline = $this->_createPipeline('my_custom_pipeline_attachment', 'pipeline for Attachment'); $pipeline->addProcessor($attachment); $pipeline->create(); @@ -145,7 +145,7 @@ public function testAttachmentAddPdfFileContent(): void */ public function testAddWordxFile(): void { - $attachment = new Attachment('data'); + $attachment = new AttachmentProcessor('data'); $pipeline = $this->_createPipeline('my_custom_pipeline_attachment', 'pipeline for Attachment'); $pipeline->addProcessor($attachment); $pipeline->create(); @@ -188,7 +188,7 @@ public function testAddWordxFile(): void */ public function testExcludeFileSource(): void { - $attachment = new Attachment('data'); + $attachment = new AttachmentProcessor('data'); $pipeline = $this->_createPipeline('my_custom_pipeline_attachment', 'pipeline for Attachment'); $pipeline->addProcessor($attachment); $pipeline->create(); diff --git a/tests/Processor/ConvertTest.php b/tests/Processor/ConvertProcessorTest.php similarity index 89% rename from tests/Processor/ConvertTest.php rename to tests/Processor/ConvertProcessorTest.php index c659eedc25..19b9d7c301 100644 --- a/tests/Processor/ConvertTest.php +++ b/tests/Processor/ConvertProcessorTest.php @@ -4,20 +4,20 @@ use Elastica\Bulk; use Elastica\Document; -use Elastica\Processor\Convert; +use Elastica\Processor\ConvertProcessor; use Elastica\Test\BasePipeline as BasePipelineTest; /** * @internal */ -class ConvertTest extends BasePipelineTest +class ConvertProcessorTest extends BasePipelineTest { /** * @group unit */ public function testConvert(): void { - $processor = new Convert('foo', 'integer'); + $processor = new ConvertProcessor('foo', 'integer'); $expected = [ 'convert' => [ @@ -34,7 +34,7 @@ public function testConvert(): void */ public function testConvertWithNonDefaultOptions(): void { - $processor = new Convert('foo', 'integer'); + $processor = new ConvertProcessor('foo', 'integer'); $processor->setIgnoreMissing(true); $expected = [ @@ -66,7 +66,7 @@ public function testConvertWithNonDefaultOptions(): void */ public function testConvertField(): void { - $append = new Convert('foo', 'float'); + $append = new ConvertProcessor('foo', 'float'); $pipeline = $this->_createPipeline('my_custom_pipeline', 'pipeline for Convert'); $pipeline->addProcessor($append)->create(); diff --git a/tests/Processor/DateIndexNameTest.php b/tests/Processor/DateIndexNameProcessorTest.php similarity index 84% rename from tests/Processor/DateIndexNameTest.php rename to tests/Processor/DateIndexNameProcessorTest.php index 0fd08d2152..5d25dde92b 100644 --- a/tests/Processor/DateIndexNameTest.php +++ b/tests/Processor/DateIndexNameProcessorTest.php @@ -2,20 +2,20 @@ namespace Elastica\Test\Processor; -use Elastica\Processor\DateIndexName; +use Elastica\Processor\DateIndexNameProcessor; use Elastica\Test\BasePipeline as BasePipelineTest; /** * @internal */ -class DateIndexNameTest extends BasePipelineTest +class DateIndexNameProcessorTest extends BasePipelineTest { /** * @group unit */ public function testDateIndexName(): void { - $processor = new DateIndexName('date1', 'M'); + $processor = new DateIndexNameProcessor('date1', 'M'); $expected = [ 'date_index_name' => [ @@ -32,7 +32,7 @@ public function testDateIndexName(): void */ public function testDateIndexNameWithNonDefaultOptions(): void { - $processor = new DateIndexName('date1', 'M'); + $processor = new DateIndexNameProcessor('date1', 'M'); $processor->setTimezone('Europe/Rome'); $processor->setLocale('ITALIAN'); $processor->setIndexNamePrefix('myindex-'); diff --git a/tests/Processor/DateTest.php b/tests/Processor/DateProcessorTest.php similarity index 83% rename from tests/Processor/DateTest.php rename to tests/Processor/DateProcessorTest.php index c042a55acf..1e670b281c 100644 --- a/tests/Processor/DateTest.php +++ b/tests/Processor/DateProcessorTest.php @@ -4,20 +4,20 @@ use Elastica\Bulk; use Elastica\Document; -use Elastica\Processor\Date; +use Elastica\Processor\DateProcessor; use Elastica\Test\BasePipeline as BasePipelineTest; /** * @internal */ -class DateTest extends BasePipelineTest +class DateProcessorTest extends BasePipelineTest { /** * @group unit */ public function testDate(): void { - $processor = new Date('initial_date', ['dd/MM/yyyy hh:mm:ss']); + $processor = new DateProcessor('initial_date', ['dd/MM/yyyy hh:mm:ss']); $expected = [ 'date' => [ @@ -28,7 +28,7 @@ public function testDate(): void $this->assertEquals($expected, $processor->toArray()); - $processor = new Date('initial_date', ['dd/MM/yyyy hh:mm:ss', 'ISO8601', 'UNIX', 'UNIX_MS']); + $processor = new DateProcessor('initial_date', ['dd/MM/yyyy hh:mm:ss', 'ISO8601', 'UNIX', 'UNIX_MS']); $expected = [ 'date' => [ @@ -45,7 +45,7 @@ public function testDate(): void */ public function testDateWithNonDefaultOptions(): void { - $processor = new Date('initial_date', ['dd/MM/yyyy hh:mm:ss', 'ISO8601', 'UNIX', 'UNIX_MS']); + $processor = new DateProcessor('initial_date', ['dd/MM/yyyy hh:mm:ss', 'ISO8601', 'UNIX', 'UNIX_MS']); $processor->setTargetField('timestamp'); $processor->setTimezone('Europe/Rome'); $processor->setLocale('ITALIAN'); @@ -68,7 +68,7 @@ public function testDateWithNonDefaultOptions(): void */ public function testDateField(): void { - $date = new Date('date_field', ['yyyy dd MM hh:mm:ss']); + $date = new DateProcessor('date_field', ['yyyy dd MM hh:mm:ss']); $date->setTargetField('date_parsed'); $date->setTimezone('Europe/Rome'); $date->setLocale('IT');