diff -u b/core/modules/breakpoint/lib/Drupal/breakpoint/Tests/BreakpointAPITest.php b/core/modules/breakpoint/lib/Drupal/breakpoint/Tests/BreakpointAPITest.php --- b/core/modules/breakpoint/lib/Drupal/breakpoint/Tests/BreakpointAPITest.php +++ b/core/modules/breakpoint/lib/Drupal/breakpoint/Tests/BreakpointAPITest.php @@ -30,19 +30,6 @@ * Test Breakpoint::buildConfigName(). */ public function testConfigName() { - $msg = "Expected InvalidBreakpointNameException thrown."; - try { - entity_create('breakpoint', array( - 'label' => Unicode::strtolower($this->randomName()), - 'source' => 'custom_module', - 'sourceType' => 'oops', - )); - $this->fail($msg); - } - catch (InvalidBreakpointNameException $e) { - $this->pass($msg); - } - // Try an invalid sourceType. $label = $this->randomName(); $breakpoint = entity_create('breakpoint', array( diff -u b/core/modules/breakpoint/lib/Drupal/breakpoint/Tests/BreakpointGroupAPITest.php b/core/modules/breakpoint/lib/Drupal/breakpoint/Tests/BreakpointGroupAPITest.php --- b/core/modules/breakpoint/lib/Drupal/breakpoint/Tests/BreakpointGroupAPITest.php +++ b/core/modules/breakpoint/lib/Drupal/breakpoint/Tests/BreakpointGroupAPITest.php @@ -31,20 +31,6 @@ * Test Breakpoint::buildConfigName(). */ public function testConfigName() { - $msg = "Expected InvalidBreakpointNameException thrown."; - try { - $label = $this->randomName(); - entity_create('breakpoint_group', array( - 'label' => $label, - 'source' => 'custom_module', - 'sourceType' => 'oops', - )); - $this->fail($msg); - } - catch (InvalidBreakpointNameException $e) { - $this->pass($msg); - } - // Try an invalid sourceType. $label = $this->randomName(); $breakpoint_group = entity_create('breakpoint_group', array( only in patch2: unchanged: --- a/core/modules/breakpoint/tests/Drupal/breakpoint/Tests/BreakpointConfigEntityUnitTest.php +++ b/core/modules/breakpoint/tests/Drupal/breakpoint/Tests/BreakpointConfigEntityUnitTest.php @@ -96,6 +96,7 @@ public function setUp() { */ public function testCalculateDependenciesModule() { $values = array( + 'name' => 'test', 'source' => 'test_module', 'sourceType' => Breakpoint::SOURCE_TYPE_MODULE, ); @@ -111,6 +112,7 @@ public function testCalculateDependenciesModule() { */ public function testCalculateDependenciesTheme() { $values = array( + 'name' => 'test', 'source' => 'test_theme', 'sourceType' => Breakpoint::SOURCE_TYPE_THEME, ); @@ -121,4 +123,15 @@ public function testCalculateDependenciesTheme() { $this->assertContains('test_theme', $dependencies['theme']); } + /** + * @expectedException \Drupal\breakpoint\InvalidBreakpointNameException + */ + public function testNameException () { + new Breakpoint(array( + 'label' => $this->randomName(), + 'source' => 'custom_module', + 'sourceType' => 'oops', + )); + } + } only in patch2: unchanged: --- a/core/modules/breakpoint/tests/Drupal/breakpoint/Tests/BreakpointGroupConfigEntityUnitTest.php +++ b/core/modules/breakpoint/tests/Drupal/breakpoint/Tests/BreakpointGroupConfigEntityUnitTest.php @@ -8,6 +8,7 @@ namespace Drupal\breakpoint\Tests; use Drupal\breakpoint\Entity\Breakpoint; +use Drupal\breakpoint\Entity\BreakpointGroup; use Drupal\Core\DependencyInjection\ContainerBuilder; use Drupal\Tests\UnitTestCase; @@ -109,6 +110,7 @@ public function setUpEntity($values) { public function testCalculateDependenciesModule() { $this->setUpEntity( array( + 'name' => 'test', 'source' => 'test_module', 'sourceType' => Breakpoint::SOURCE_TYPE_MODULE, ) @@ -134,6 +136,7 @@ public function testCalculateDependenciesModule() { public function testCalculateDependenciesTheme() { $this->setUpEntity( array( + 'name' => 'test', 'source' => 'test_theme', 'sourceType' => Breakpoint::SOURCE_TYPE_THEME, ) @@ -155,4 +158,15 @@ public function testCalculateDependenciesTheme() { $this->assertContains('breakpoint.breakpoint.test', $dependencies['entity']); } + /** + * @expectedException \Drupal\breakpoint\InvalidBreakpointNameException + */ + public function testNameException () { + new BreakpointGroup(array( + 'label' => $this->randomName(), + 'source' => 'custom_module', + 'sourceType' => 'oops', + )); + } + } only in patch2: unchanged: --- a/core/modules/responsive_image/tests/Drupal/responsive_image/Tests/ResponsiveImageMappingEntityTest.php +++ b/core/modules/responsive_image/tests/Drupal/responsive_image/Tests/ResponsiveImageMappingEntityTest.php @@ -99,7 +99,7 @@ public function setUp() { $this->uuid = $this->getMock('\Drupal\Component\Uuid\UuidInterface'); $this->breakpointGroupId = $this->randomName(9); - $this->breakpointGroup = $this->getMock('Drupal\breakpoint\Entity\BreakpointGroup', array(), array(array('id' => $this->breakpointGroupId))); + $this->breakpointGroup = $this->getMock('Drupal\breakpoint\Entity\BreakpointGroup', array(), array(array('name' => 'test', 'id' => $this->breakpointGroupId))); $this->breakpointGroupStorage = $this->getMock('\Drupal\Core\Config\Entity\ConfigEntityStorageInterface'); $this->breakpointGroupStorage