/** * @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 ::setBreakpointGroup * @covers ::getBreakpointGroup */ public function testSetBreakpointGroup() { $entity = new ResponsiveImageMapping(array('breakpointGroup' => 'test_group')); $entity->addMapping('test_breakpoint', '1x', 'test_style'); $entity->addMapping('test_breakpoint', '2x', 'test_style2'); $entity->addMapping('test_breakpoint2', '1x', 'test_style3'); // Ensure that setting to same group does not remove mappings. $entity->setBreakpointGroup('test_group'); $this->assertTrue($entity->hasMappings()); $this->assertEquals('test_group', $entity->getBreakpointGroup()); // Ensure that changing the group removes mappings. $entity->setBreakpointGroup('test_group2'); $this->assertEquals('test_group2', $entity->getBreakpointGroup()); $this->assertFalse($entity->hasMappings()); }