/** * Gets a list of email templates suitable for populating the email template dropdown. * * @return array */ public function getEmailTemplateDropdownValues() { $templates = array(); $finder = new SS_FileFinder(); $finder->setOption('name_regex', '/^.*\\.ss$/'); $found = $finder->find(BASE_PATH . '/' . UserDefinedForm::config()->email_template_directory); foreach ($found as $key => $value) { $template = pathinfo($value); $templates[$template['filename']] = $template['filename']; } return $templates; }
public function testMultipleGenerateManipulationCalls_Regeneration() { $image = $this->objFromFixture('Image', 'imageWithoutTitle'); $folder = new SS_FileFinder(); $imageFirst = $image->Pad(200, 200); $this->assertNotNull($imageFirst); $expected = 200; $actual = $imageFirst->getWidth(); $this->assertEquals($expected, $actual); $imageSecond = $imageFirst->setHeight(100); $this->assertNotNull($imageSecond); $expected = 100; $actual = $imageSecond->getHeight(); $this->assertEquals($expected, $actual); $imageThird = $imageSecond->Pad(600, 600, '0F0F0F'); // Encoding of the arguments is duplicated from cacheFilename $argumentString = Convert::base64url_encode(array(600, 600, '0F0F0F')); $this->assertNotNull($imageThird); $this->assertContains($argumentString, $imageThird->getFullPath(), 'Image contains background color for padded resizement'); $resampledFolder = dirname($image->getFullPath()) . "/_resampled"; $filesInFolder = $folder->find($resampledFolder); $this->assertEquals(3, count($filesInFolder), 'Image folder contains only the expected number of images before regeneration'); $imageThirdPath = $imageThird->getFullPath(); $stats = getimagesize($imageThirdPath); $this->assertEquals(3, $image->regenerateFormattedImages(), 'Cached images were regenerated in the right number'); $this->assertEquals($stats, getimagesize($imageThirdPath), 'Regeneration of third image is correct'); /* Check that no other images exist, to ensure that the regeneration did not create other images */ $this->assertEquals($filesInFolder, $folder->find($resampledFolder), 'Image folder contains only the expected image files after regeneration'); }