diff --git a/core/modules/breakpoint/lib/Drupal/breakpoint/Entity/Breakpoint.php b/core/modules/breakpoint/lib/Drupal/breakpoint/Entity/Breakpoint.php index e8f7294..993eae8 100644 --- a/core/modules/breakpoint/lib/Drupal/breakpoint/Entity/Breakpoint.php +++ b/core/modules/breakpoint/lib/Drupal/breakpoint/Entity/Breakpoint.php @@ -284,4 +284,116 @@ public static function isValidMediaQuery($media_query) { } throw new InvalidBreakpointMediaQueryException('Media query is empty.'); } + + /** + * @param \Drupal\breakpoint\Entity\weight $weight + */ + public function setWeight($weight) + { + $this->weight = $weight; + } + + /** + * @return \Drupal\breakpoint\Entity\weight + */ + public function getWeight() + { + return $this->weight; + } + + /** + * @param string $sourceType + */ + public function setSourceType($sourceType) + { + $this->sourceType = $sourceType; + } + + /** + * @return string + */ + public function getSourceType() + { + return $this->sourceType; + } + + /** + * @param string $source + */ + public function setSource($source) + { + $this->source = $source; + } + + /** + * @return string + */ + public function getSource() + { + return $this->source; + } + + /** + * @param string $name + */ + public function setName($name) + { + $this->name = $name; + } + + /** + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * @param \Drupal\breakpoint\Entity\multipliers $multipliers + */ + public function setMultipliers($multipliers) + { + $this->multipliers = $multipliers; + } + + /** + * @return \Drupal\breakpoint\Entity\multipliers + */ + public function getMultipliers() + { + return $this->multipliers; + } + + /** + * @param string $mediaQuery + */ + public function setMediaQuery($mediaQuery) + { + $this->mediaQuery = $mediaQuery; + } + + /** + * @return string + */ + public function getMediaQuery() + { + return $this->mediaQuery; + } + + /** + * @param string $label + */ + public function setLabel($label) + { + $this->label = $label; + } + + /** + * @return string + */ + public function getLabel() + { + return $this->label; + } } diff --git a/core/modules/breakpoint/tests/Drupal/breakpoint/Tests/BreakpointAPITest.php b/core/modules/breakpoint/tests/Drupal/breakpoint/Tests/BreakpointAPITest.php new file mode 100644 index 0000000..f35a651 --- /dev/null +++ b/core/modules/breakpoint/tests/Drupal/breakpoint/Tests/BreakpointAPITest.php @@ -0,0 +1,51 @@ + 'Breakpoint API tests', + 'description' => 'Test validation of class properties.', + 'group' => 'Breakpoint', + ); + } + + /** + * Test property setters and getters. + */ + public function testProperties() { + $breakpoint = new Breakpoint( array(), 'Breakpoint'); + + // Properties to test with some random data. + // i.e setLabel($randomdata) and getLabel() + $properties = array( + 'Label' => $this->getRandomGenerator()->name(16), + 'MediaQuery' => $this->getRandomGenerator()->string(16), + 'Multipliers' => array($this->getRandomGenerator()->string(16),$this->getRandomGenerator()->string(16)), + 'Name' => $this->getRandomGenerator()->name(16), + 'Source' => $this->getRandomGenerator()->name(16), + 'SourceType' => $this->getRandomGenerator()->name(16), + 'Weight' => mt_rand(-40, 40), + ); + + foreach($properties as $name => $value) { + $breakpoint->{'set'.$name}($value); + $this->assertEquals($value, $breakpoint->{'get'.$name}(), 'breakpoint_property: set'. $name .' and get'. $name); + } + } +}