diff --cc core/modules/breakpoint/lib/Drupal/breakpoint/Entity/Breakpoint.php index 5fa0260,36ddd1e..0000000 --- a/core/modules/breakpoint/lib/Drupal/breakpoint/Entity/Breakpoint.php +++ b/core/modules/breakpoint/lib/Drupal/breakpoint/Entity/Breakpoint.php @@@ -103,21 -104,9 +104,21 @@@ class Breakpoint extends ConfigEntityBa * * @var multipliers */ - public $multipliers = array(); + protected $multipliers = array(); /** + * {@inheritdoc} + */ + public function id() { + // If no ID is specified, build one from the properties that uniquely define + // this breakpoint. + if (!isset($this->id)) { + $this->id = $this->sourceType . '.' . $this->source . '.' . $this->name; + } + return $this->id; + } + + /** * Overrides Drupal\config\ConfigEntityBase::save(). */ public function save() { diff --cc core/modules/breakpoint/lib/Drupal/breakpoint/Tests/BreakpointAPITest.php index e132280,5135797..0000000 --- a/core/modules/breakpoint/lib/Drupal/breakpoint/Tests/BreakpointAPITest.php +++ b/core/modules/breakpoint/lib/Drupal/breakpoint/Tests/BreakpointAPITest.php @@@ -6,7 -6,7 +6,7 @@@ namespace Drupal\breakpoint\Tests; --use Drupal\breakpoint\Tests\BreakpointsTestBase; ++use Drupal\breakpoint\Tests\BreakpointTestBase; use Drupal\breakpoint\Entity\Breakpoint; use Drupal\breakpoint\InvalidBreakpointNameException; use Drupal\breakpoint\InvalidBreakpointSourceException; @@@ -46,9 -46,9 +46,9 @@@ class BreakpointAPITest extends Breakpo $this->assertTrue($exception, 'breakpoint_config_name: An exception is thrown when an invalid sourceType is entered.'); // Try an invalid source. - $breakpoint->enforceIsNew(); + $breakpoint = $breakpoint->createDuplicate(); - $breakpoint->sourceType = Breakpoint::SOURCE_TYPE_USER_DEFINED; - $breakpoint->source = 'custom*_module source'; + $breakpoint->setSourceType(Breakpoint::SOURCE_TYPE_USER_DEFINED) + ->setSource('custom*_module source'); $exception = FALSE; try { @@@ -60,9 -60,9 +60,9 @@@ $this->assertTrue($exception, 'breakpoint_config_name: An exception is thrown when an invalid source is entered.'); // Try an invalid name (make sure there is at least once capital letter). - $breakpoint->enforceIsNew(); + $breakpoint = $breakpoint->createDuplicate(); - $breakpoint->source = 'custom_module'; - $breakpoint->name = drupal_ucfirst($this->randomName()); + $breakpoint->setSource('custom_module') + ->setName(drupal_ucfirst($this->randomName())); $exception = FALSE; try { @@@ -74,9 -74,9 +74,9 @@@ $this->assertTrue($exception, 'breakpoint_config_name: An exception is thrown when an invalid name is entered.'); // Try a valid breakpoint. - $breakpoint->enforceIsNew(); + $breakpoint = $breakpoint->createDuplicate(); - $breakpoint->name = drupal_strtolower($this->randomName()); - $breakpoint->mediaQuery = 'all'; + $breakpoint->setName(drupal_strtolower($this->randomName())) + ->setMediaQuery('all'); $exception = FALSE; try {