/** * Verify that a breakpoint is properly stored. */ public function verifyBreakpointGroup(BreakpointGroup $group, BreakpointGroup $compare_set = NULL) { $properties = array('label', 'id', 'name', 'sourceType'); // Verify breakpoint_group_load(). $compare_set = is_null($compare_set) ? entity_load('breakpoint_group', $group->id()) : $compare_set; foreach ($properties as $property) { $t_args = array('%group' => $group->label(), '%property' => $property); if (is_array($compare_set->{$property})) { $this->assertEqual(array_keys($compare_set->{$property}), array_keys($group->{$property}), format_string('breakpoint_group_load: Proper %property for breakpoint group %group.', $t_args), 'Breakpoint API'); } else { $t_args = array('%group' => $group->label(), '%property' => $property, '%property1' => $compare_set->{$property}, '%property2' => $group->{$property}); $this->assertEqual($compare_set->{$property}, $group->{$property}, format_string('breakpoint_group_load: Proper %property: %property1 == %property2 for breakpoint group %group.', $t_args), 'Breakpoint API'); } } // Ensure that the breakpoint group has the expected breakpoints. $this->assertEqual(array_keys($compare_set->getBreakpoints()), array_keys($group->getBreakpoints())); }
/** * @covers ::calculateDependencies */ public function testCalculateDependencies() { $responsive_image_mapping = new ResponsiveImageMapping(array(), $this->entityTypeId); // Set the breakpoint group after creating the entity to avoid the calls // in the constructor. $responsive_image_mapping->setBreakpointGroup($this->breakpointGroupId); $this->breakpointGroup->expects($this->once())->method('getConfigDependencyName')->will($this->returnValue('breakpoint.breakpoint_group.' . $this->breakpointGroupId)); $dependencies = $responsive_image_mapping->calculateDependencies(); $this->assertContains('breakpoint.breakpoint_group.' . $this->breakpointGroupId, $dependencies['entity']); }
/** * @covers ::calculateDependencies */ public function testCalculateDependenciesTheme() { $this->setUpEntity(array('name' => 'test', 'source' => 'test_theme', 'sourceType' => Breakpoint::SOURCE_TYPE_THEME)); $breakpoint = $this->getMockBuilder('\\Drupal\\breakpoint\\Entity\\Breakpoint')->disableOriginalConstructor()->getMock(); $breakpoint->expects($this->once())->method('getConfigDependencyName')->will($this->returnValue('breakpoint.breakpoint.test')); $this->entity->expects($this->once())->method('getBreakpoints')->will($this->returnValue(array($breakpoint))); $dependencies = $this->entity->calculateDependencies(); $this->assertArrayNotHasKey('module', $dependencies); $this->assertContains('test_theme', $dependencies['theme']); $this->assertContains('breakpoint.breakpoint.test', $dependencies['entity']); }