You are here

protected function BpcDisplayTestCase::displayExists in Commerce Bulk Product Creation 7.2

Determines wether a display node exists that references all and only all the given products.

Parameters

array $product_ids: An array of product ids that should be referenced by the display node.

string $type: (optional) The node type to which the search should be restricted. Defaults to 'product_display'.

Return value

bool Boolean indicating whether such a display node exists.

2 calls to BpcDisplayTestCase::displayExists()
BpcDisplayTestCase::assertDisplayExists in modules/bpc_display/bpc_display.test
Asserts that a display node exists that references all and only all the given products.
BpcDisplayTestCase::assertNoDisplayExists in modules/bpc_display/bpc_display.test
Asserts that no display node exists that references all and only all the given products.

File

modules/bpc_display/bpc_display.test, line 232
Tests for Commerce BPC display node creation

Class

BpcDisplayTestCase
@file Tests for Commerce BPC display node creation

Code

protected function displayExists($product_ids, $type = 'product_display') {
  $nodes = $this
    ->findDisplaysFor($product_ids, $type);
  foreach ($nodes as $node) {
    if (count($node->field_product[LANGUAGE_NONE]) == count($product_ids)) {
      return TRUE;
    }
  }
  return FALSE;
}