diff --git a/core/modules/responsive_image/src/Tests/ResponsiveImageThemeFunctionsTest.php b/core/modules/responsive_image/src/Tests/ResponsiveImageThemeFunctionsTest.php
new file mode 100644
index 0000000..7590864
--- /dev/null
+++ b/core/modules/responsive_image/src/Tests/ResponsiveImageThemeFunctionsTest.php
@@ -0,0 +1,154 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\responsive_image\Tests\ResponsiveImageThemeFunctionsTest.
+ */
+
+namespace Drupal\responsive_image\Tests;
+
+use Drupal\Core\Field\FieldStorageDefinitionInterface;
+use Drupal\simpletest\WebTestBase;
+
+/**
+ * Tests responsive_image theme functions.
+ * @group responsive_image
+ */
+class ResponsiveImageThemeFunctionsTest extends WebTestBase {
+
+  /**
+   * Modules to enable.
+   *
+   * @var array
+   */
+  public static $modules = array('responsive_image', 'entity_test');
+
+  /**
+   * Created file entity.
+   *
+   * @var \Drupal\file\Entity\File
+   */
+  protected $image;
+
+  public static function getInfo() {
+    return array(
+      'name' => 'Responsive Image theme functions',
+      'description' => 'Tests the responsive_image theme functions.',
+      'group' => 'Responsive Image',
+    );
+  }
+
+  public function setUp() {
+    parent::setUp();
+
+    entity_create('field_config', array(
+      'name' => 'image_test',
+      'entity_type' => 'entity_test',
+      'type' => 'image',
+      'cardinality' => FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED,
+    ))->save();
+    entity_create('field_instance_config', array(
+      'entity_type' => 'entity_test',
+      'field_name' => 'image_test',
+      'bundle' => 'entity_test',
+    ))->save();
+    file_unmanaged_copy(DRUPAL_ROOT . '/core/misc/druplicon.png', 'public://example.jpg');
+    $this->image = entity_create('file', array(
+      'uri' => 'public://example.jpg',
+    ));
+    $this->image->save();
+    $this->imageFactory = $this->container->get('image.factory');
+  }
+
+  /**
+   * Tests usage of the theme_picture() function.
+   */
+  function testResponsiveImageThemeFunction() {
+    // Create an image.
+    $files = $this->drupalGetTestFiles('image');
+    $file = reset($files);
+    $original_uri = file_unmanaged_copy($file->uri, 'public://', FILE_EXISTS_RENAME);
+
+    // Create a style.
+    $style = entity_create('image_style', array('name' => 'test', 'label' => 'Test'));
+    $style->save();
+    $url = $style->buildUrl($original_uri);
+
+    // Test using theme_picture() with a NULL value for the alt option.
+    $path = $this->randomName();
+    $element = array(
+      '#theme' => 'responsive_image',
+      '#uri' => $original_uri,
+      '#alt' => NULL,
+      '#style_name' => 'test',
+    );
+    $rendered_element = render($element);
+    $expected_result = '<img class="image-style-test" src="' . $url . '" />';
+    $this->assertTrue(strpos($rendered_element, $expected_result) !== FALSE, 'img element in theme_responsive_image() correctly renders with a NULL value for the alt option.');
+    $this->assertTrue(strpos($rendered_element, '<picture>') !== FALSE, 'picture element in theme_responsive_image() correctly renders with a NULL value for the alt option.');
+
+    // Test using theme_picture() without passing a value for the alt option.
+    unset($element['#alt']);
+    $rendered_element = render($element);
+    $expected_result = '<img class="image-style-test" src="' . $url . '" alt="" />';
+    $this->assertTrue(strpos($rendered_element, $expected_result) !== FALSE, 'img element in theme_responsive_image() correctly renders the alt option.');
+    $this->assertTrue(strpos($rendered_element, '<picture alt="">') !== FALSE, 'picture element in theme_responsive_image() correctly renders the alt option.');
+  }
+
+  /**
+   * Tests usage of the theme_picture_formatter() function.
+   */
+  function testPictureFormatterThemeFunction() {
+    // Create an image.
+    $files = $this->drupalGetTestFiles('image');
+    $file = reset($files);
+    $original_uri = file_unmanaged_copy($file->uri, 'public://', FILE_EXISTS_RENAME);
+
+    // Create a style.
+    $style = entity_create('image_style', array('name' => 'test', 'label' => 'Test'));
+    $style->save();
+    $url = $style->buildUrl($original_uri);
+
+    // Create a test entity with the image field set.
+    $entity = entity_create('entity_test', array());
+    $entity->image_test->target_id = $this->image->id();
+    $entity->image_test->alt = NULL;
+    $entity->image_test->uri = $original_uri;
+    $image = $this->imageFactory->get('public://example.jpg');
+    $entity->save();
+
+    $path = $this->randomName();
+    $element = array(
+      '#theme' => 'responsive_image_formatter',
+      '#item' => $entity->image_test,
+      '#image_style' => 'test',
+      '#path' => array(
+        'path' => $path,
+      ),
+    );
+
+    // Test using theme_picture_formatter() without breakpoints and with a NULL
+    // value for the alt option.
+    $rendered_element = render($element);
+    $expected_result = '<a href="' . base_path() . $path . '"><img class="image-style-test" src="' . $url . '" width="' . $image->getWidth() . '" height="' . $image->getHeight() . '" /></a>';
+    $this->assertEqual($expected_result, $rendered_element, 'theme_responsive_image_formatter() correctly renders without breakpoints and with a NULL value for the alt option.');
+
+    // Test using theme_picture_formatter() without an image title, alt text, or
+    // link options.
+    $element['#item']->alt = '';
+    $rendered_element = render($element);
+    $expected_result = '<a href="' . base_path() . $path . '"><img class="image-style-test" src="' . $url . '" width="' . $image->getWidth() . '" height="' . $image->getHeight() . '" alt="" /></a>';
+    $this->assertEqual($expected_result, $rendered_element, 'theme_responsive_image_formatter() correctly renders without title, alt, or path options.');
+
+    // Link the image to a fragment on the page, and not a full URL.
+    $fragment = $this->randomName();
+    $element['#path']['path'] = '';
+    $element['#path']['options'] = array(
+      'external' => TRUE,
+      'fragment' => $fragment,
+    );
+    $rendered_element = render($element);
+    $expected_result = '<a href="#' . $fragment . '"><img class="image-style-test" src="' . $url . '" width="' . $image->getWidth() . '" height="' . $image->getHeight() . '" alt="" /></a>';
+    $this->assertEqual($expected_result, $rendered_element, 'theme_responsive_image_formatter() correctly renders a link fragment.');
+  }
+}
