'Juicebox field formatter tests', 'description' => 'Tests the Juicebox field formatter.', 'group' => 'Juicebox', ); } /** * Define setup tasks. */ public function setUp() { parent::setUp('juicebox'); // Create and login user. $this->webUser = $this->drupalCreateUser(array('access content', 'access administration pages', 'administer site configuration', 'administer content types', 'administer nodes', 'create article content', 'edit any article content', 'delete any article content', 'administer image styles', 'search content', 'access contextual links', 'administer fields')); $this->drupalLogin($this->webUser); // Prep an article with an image field and activate the Juicebox display // formatter for it. $this->prepArticle(); $this->activateJuiceboxFieldFormatter($this->instance); } /** * Test base logic for the Juicebox field formatter. */ public function testFieldFormatter() { $instance = $this->instance; $node = $this->node; $xml_path = 'juicebox/xml/field/node/' . $node->nid . '/' . $instance['field_name'] . '/full'; // Get the urls to the test image and thumb derivative used by default. Note // that the "large" style will be used for the article's field_image because // that's was its formatter was set to before being flipped into a Juicebox // display. $items = field_get_items('node', $node, $instance['field_name']); $item = reset($items); $test_image_url = image_style_url('large', $item['uri']); $test_thumb_url = image_style_url('juicebox_square_thumbnail', $item['uri']); // Check for correct embed markup. $this->drupalGet('node/' . $node->nid); $this->assertRaw(trim(json_encode(array('configUrl' => url($xml_path))), '{}"'), 'Gallery setting found in Drupal.settings.'); $this->assertRaw('id="field--node--' . $node->nid . '--' . str_replace('_', '-', $instance['field_name']) . '--full"', 'Embed code wrapper found.'); $this->assertRaw('