From f3f7d4dc61b149d07bce16777fb6a266a384c94c Mon Sep 17 00:00:00 2001 From: John Oleksowicz Date: Mon, 10 Apr 2023 11:18:16 -0500 Subject: [PATCH] Remove redundant tests MAILPOET-5083 --- .../Filters/WooCommerceNumberOfOrdersTest.php | 41 ------------------ .../Filters/WooCommerceProductTest.php | 43 ------------------- 2 files changed, 84 deletions(-) diff --git a/mailpoet/tests/integration/Segments/DynamicSegments/Filters/WooCommerceNumberOfOrdersTest.php b/mailpoet/tests/integration/Segments/DynamicSegments/Filters/WooCommerceNumberOfOrdersTest.php index 26c57ff8c2..95516470cd 100644 --- a/mailpoet/tests/integration/Segments/DynamicSegments/Filters/WooCommerceNumberOfOrdersTest.php +++ b/mailpoet/tests/integration/Segments/DynamicSegments/Filters/WooCommerceNumberOfOrdersTest.php @@ -70,47 +70,6 @@ class WooCommerceNumberOfOrdersTest extends \MailPoetTest { $this->assertEqualsCanonicalizing([$createdSub->getEmail()], $emails); } - /** - * @dataProvider allowedStatuses - */ - public function testItIncludesAllowedStatuses($status) { - $email = "$status@example.com"; - $customerId = $this->tester->createCustomer($email, 'customer'); - $this->createOrder($customerId, Carbon::now(), $status); - $segmentFilterData = $this->getSegmentFilterData('=', 1, 1); - $emails = $this->tester->getSubscriberEmailsMatchingDynamicFilter($segmentFilterData, $this->numberOfOrdersFilter); - expect($emails)->contains($email); - } - - /** - * @dataProvider disallowedStatuses - */ - public function testItExcludesDisallowedOrderStatuses($status) { - $email = "$status@example.com"; - $customerId = $this->tester->createCustomer($email, 'customer'); - $this->createOrder($customerId, Carbon::now(), $status); - $segmentFilterData = $this->getSegmentFilterData('=', 1, 1); - $emails = $this->tester->getSubscriberEmailsMatchingDynamicFilter($segmentFilterData, $this->numberOfOrdersFilter); - expect($emails)->notContains($email); - } - - public function allowedStatuses() { - return [ - 'completed' => ['wc-completed'], - 'processing' => ['wc-processing'], - ]; - } - - public function disallowedStatuses() { - return [ - 'refunded' => ['wc-refunded'], - 'cancelled' => ['wc-cancelled'], - 'on hold' => ['wc-on-hold'], - 'pending' => ['wc-pending'], - 'failed' => ['wc-failed'], - ]; - } - private function getSegmentFilterData(string $comparisonType, int $ordersCount, int $days): DynamicSegmentFilterData { return new DynamicSegmentFilterData(DynamicSegmentFilterData::TYPE_WOOCOMMERCE, WooCommerceNumberOfOrders::ACTION_NUMBER_OF_ORDERS, [ 'number_of_orders_type' => $comparisonType, diff --git a/mailpoet/tests/integration/Segments/DynamicSegments/Filters/WooCommerceProductTest.php b/mailpoet/tests/integration/Segments/DynamicSegments/Filters/WooCommerceProductTest.php index 30b39cd171..0ce66312f4 100644 --- a/mailpoet/tests/integration/Segments/DynamicSegments/Filters/WooCommerceProductTest.php +++ b/mailpoet/tests/integration/Segments/DynamicSegments/Filters/WooCommerceProductTest.php @@ -81,49 +81,6 @@ class WooCommerceProductTest extends \MailPoetTest { $this->assertEqualsCanonicalizing($expectedEmails, $emails); } - /** - * @dataProvider allowedStatuses - */ - public function testItIncludesAllowedStatuses($status) { - $email = "status-customer@example.com"; - $customerId = $this->tester->createCustomer($email, 'customer'); - $orderId = $this->createOrder($customerId, Carbon::now(), $status); - $this->addToOrder(5, $orderId, $this->productIds[0], $customerId); - $segmentFilterData = $this->getSegmentFilterData($this->productIds, DynamicSegmentFilterData::OPERATOR_ANY); - $emails = $this->tester->getSubscriberEmailsMatchingDynamicFilter($segmentFilterData, $this->wooCommerceProductFilter); - expect($emails)->contains($email); - } - - /** - * @dataProvider disallowedStatuses - */ - public function testItExcludesDisallowedOrderStatuses($status) { - $email = "status-customer@example.com"; - $customerId = $this->tester->createCustomer($email, 'customer'); - $orderId = $this->createOrder($customerId, Carbon::now(), $status); - $this->addToOrder(5, $orderId, $this->productIds[0], $customerId); - $segmentFilterData = $this->getSegmentFilterData($this->productIds, DynamicSegmentFilterData::OPERATOR_ANY); - $emails = $this->tester->getSubscriberEmailsMatchingDynamicFilter($segmentFilterData, $this->wooCommerceProductFilter); - expect($emails)->notContains($email); - } - - public function allowedStatuses() { - return [ - 'completed' => ['wc-completed'], - 'processing' => ['wc-processing'], - ]; - } - - public function disallowedStatuses() { - return [ - 'refunded' => ['wc-refunded'], - 'cancelled' => ['wc-cancelled'], - 'on hold' => ['wc-on-hold'], - 'pending' => ['wc-pending'], - 'failed' => ['wc-failed'], - ]; - } - private function getSegmentFilterData(array $productIds, string $operator): DynamicSegmentFilterData { $filterData = [ 'product_ids' => $productIds,