Chris@0: randomMachineName()); Chris@0: $min_resolution = 50; Chris@0: $max_resolution = 100; Chris@0: $field_settings = [ Chris@0: 'max_resolution' => $max_resolution . 'x' . $max_resolution, Chris@0: 'min_resolution' => $min_resolution . 'x' . $min_resolution, Chris@0: 'alt_field' => 0, Chris@0: ]; Chris@0: $this->createImageField($field_name, 'article', [], $field_settings, [], [], 'Image test on [site:name]'); Chris@0: $this->drupalGet('node/add/article'); Chris@0: $this->assertNotEqual(0, count($this->xpath('//div[contains(@class, "field--widget-image-image")]')), 'Image field widget found on add/node page', 'Browser'); Chris@0: $this->assertNotEqual(0, count($this->xpath('//input[contains(@accept, "image/*")]')), 'Image field widget limits accepted files.', 'Browser'); Chris@0: $this->assertNoText('Image test on [site:name]'); Chris@14: Chris@14: // Check for allowed image file extensions - default. Chris@14: $this->assertText('Allowed types: png gif jpg jpeg.'); Chris@14: Chris@14: // Try adding to the field config an unsupported extension, should not Chris@14: // appear in the allowed types. Chris@14: $field_config = FieldConfig::loadByName('node', 'article', $field_name); Chris@14: $field_config->setSetting('file_extensions', 'png gif jpg jpeg tiff')->save(); Chris@14: $this->drupalGet('node/add/article'); Chris@14: $this->assertText('Allowed types: png gif jpg jpeg.'); Chris@14: Chris@14: // Add a supported extension and remove some supported ones, we should see Chris@14: // the intersect of those entered in field config with those supported. Chris@14: $field_config->setSetting('file_extensions', 'png jpe tiff')->save(); Chris@14: $this->drupalGet('node/add/article'); Chris@14: $this->assertText('Allowed types: png jpe.'); Chris@0: } Chris@0: Chris@0: }