public function CommerceBaseTesterTestCase::testTestCreateDummyProductDisplayAndRefField in Commerce Core 7
Test the creation of a product_display content type and add a product reference field to the content type.
File
- tests/
commerce_base.test, line 851 - Defines abstract base test class for the Commerce module tests.
Class
- CommerceBaseTesterTestCase
- Test class to test the CommerceBaseTestCase functions. All testTestFoo functions have "testTest" in the name to indicate that they are verifying that a test is working. Somewhat "meta" to do this, but it eases test development.
Code
public function testTestCreateDummyProductDisplayAndRefField() {
$this
->createDummyProductDisplayContentType();
$this
->drupalLogin($this->site_admin);
$this
->drupalGet('node/add/product-display');
$this
->assertText('product_display', t('product_display content type successfully created and accessible.'));
//$this->assertOptionSelected('edit-field-product-und', '_none', 'Dummy Product Display reference field shows up on node add page');
$this
->assertFieldById('edit-field-product-und', '', t('Product reference field found on Dummy Product Display.'));
// Try to add the same field a second time and see if any errors pop up.
// If uncommented, this will product an error. Basically, this should be
// turned into an assertion that checks for the presence of the field.
//$this->attachProductReferenceField('product_display', 'field_product');
}