Skip to content

Commit 7a3ea4e

Browse files
committed
#14355: Write failing collection test
1 parent fe17868 commit 7a3ea4e

File tree

1 file changed

+16
-0
lines changed
  • dev/tests/integration/testsuite/Magento/Catalog/Model/ResourceModel/Product

1 file changed

+16
-0
lines changed

dev/tests/integration/testsuite/Magento/Catalog/Model/ResourceModel/Product/CollectionTest.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,4 +149,20 @@ public function testJoinTable()
149149

150150
self::assertContains($expected, str_replace(PHP_EOL, '', $sql));
151151
}
152+
153+
/**
154+
* Checks that a collection uses the correct join when filtering by null.
155+
*
156+
* This actually affects AbstractCollection, but inheritance yada yada.
157+
*
158+
* @magentoDataFixture Magento/Catalog/Model/ResourceModel/_files/product_simple.php
159+
* @magentoDbIsolation enabled
160+
*/
161+
public function testFilterByNull()
162+
{
163+
$this->collection->addAttributeToFilter([['attribute' => 'special_price', 'null' => true]]);
164+
$productCount = $this->collection->count();
165+
166+
$this->assertEquals(1, $productCount, 'Product with null special_price not found');
167+
}
152168
}

0 commit comments

Comments
 (0)