Results
17.07.2024
basket_imex 10.x-dev ::
modules/basket_excel/basket_excel.module
if (! empty ( $download ) && $system == 'excel' ) { if (! empty (\Drupal::request()->query->get( 'run' ))) { ( new generateFile( $systemBase ))->run( $download , $imexEntity ); exit ; } foreach (Element::children( $form ) as $formKey ) { $form [ $formKey ][ '#access' ] = FALSE; } $downloadUrl = Url::fromRoute( 'basket.admin.pages' , [ |
22.03.2020
bs_lib 8.x-1.0-alpha3 ::
src/Commands/BsLibCommands.php
// Generate some files from the scratch. $this ->generateFile( "config/schema/{$child_machine_name}.schema.yml" , $options ); $this ->generateFile( 'gulp-options.yml' , $options ); $this ->generateFile( $child_machine_name . '.info.yml' , $options ); $this ->generateFile( $child_machine_name . '.libraries.yml' , $options ); $this ->generateFile( 'README.md' , $options ); // Rebuild themes static cache because new theme is created. $this ->drupalThemeListInfo(TRUE); // Make sure we are on latest parent theme versions. $update_functions = $this ->GetUpdateHooks( $child_machine_name ); |
06.11.2019
content_export_yaml 8.x-2.9 ::
src/ContentExport.php
$export_path = DRUPAL_ROOT . '/' . $export_path ; $final_path = $export_path . '/' . $entity . '/' . $item ->bundle(); $status = $this ->generateFile( $final_path , $item ->id(), $yaml_content ); //@todo move to manager_content_export_yaml // if($status){ // $dbstatus = $this->db->is_exist($item->id(),$entity,$item->bundle()); // if(empty($dbstatus)){ // $fields = array( // 'entity_id'=> $item->id() , |
* @ return bool */ function generateFile( $directory , $filename , $content ) { $fileSystem = \Drupal::service( 'file_system' ); if (! is_dir ( $directory )) { if ( $fileSystem -> mkdir ( $directory , 0777, TRUE) === FALSE) { $this ->logger->error( 'Failed to create directory ' . $directory ); \Drupal::messenger()->addMessage(t( 'Failed to create directory ' . $directory ), 'error' ); |
18.09.2020
external_entities 8.x-2.x-dev ::
tests/src/Functional/FileClientFunctionalTest.php
$this ->fileSystem = $this ->container->get( 'file_system' ); $file_path = $this ->generateFile( 'test' , 21, 2, 'text' ); $filename = $this ->fileSystem-> basename ( $file_path ); $directory = $this ->fileSystem->dirname( $file_path ); $this ->assertFileExists( $file_path ); // Storage client. $this ->storage = $this ->container->get( 'entity_type.manager' )->getStorage( 'external_entity_type' ); |
01.06.2020
features 8.x-3.11 ::
src/Plugin/FeaturesGeneration/FeaturesGenerationWrite.php
* @throws Exception */ protected function generateFile( $directory , array $file ) { if (! empty ( $file [ 'subdirectory' ])) { $directory .= '/' . $file [ 'subdirectory' ]; } $directory = $this ->root . '/' . $directory ; if (! is_dir ( $directory )) { if ( $this ->fileSystem-> mkdir ( $directory , NULL, TRUE) === FALSE) { |
01.06.2020
features 8.x-3.11 ::
src/Plugin/FeaturesGeneration/FeaturesGenerationArchive.php
* @throws Exception */ protected function generateFile( $directory , array $file , ArchiveTar $archiver ) { $filename = $directory ; if (! empty ( $file [ 'subdirectory' ])) { $filename .= '/' . $file [ 'subdirectory' ]; } $filename .= '/' . $file [ 'filename' ]; // Set the mode to 0644 rather than the default of 0600. |
30.07.2020
file_download_link 8.x-1.0 ::
tests/src/Functional/FileDownloadLinkMultilingualTest.php
$this ->drupalLogin( $admin_user ); $english_uri = $this ::generateFile( 'my-english-text' , 10, 10, 'text' ); $english_file = File::create([ 'uri' => $english_uri , 'filename' => 'my-english-text' , ]); $english_file ->save(); $french_uri = $this ::generateFile( 'ma-texte-francaise' , 10, 11, 'text' ); $french_file = File::create([ 'uri' => $french_uri , 'filename' => 'ma-texte-francaise' , ]); $french_file ->save(); |
30.07.2020
file_download_link 8.x-1.0 ::
tests/src/Functional/FileDownloadLinkXssTest.php
$this ->drupalLogin( $admin_user ); $english_uri = $this ::generateFile( 'my-english-text' , 10, 10, 'text' ); $english_file = File::create([ 'uri' => $english_uri , 'filename' => 'my-english-text' , ]); $english_file ->save(); $french_uri = $this ::generateFile( 'ma-texte-francaise' , 10, 11, 'text' ); $french_file = File::create([ 'uri' => $french_uri , 'filename' => 'ma-texte-francaise' , ]); $french_file ->save(); |
27.04.2021
file_encrypt 8.x-1.x-dev ::
tests/src/Functional/FunctionalTestBase.php
$count = 0; foreach ( $lines as $line ) { TestFileCreationTrait::generateFile( 'text-' . $count ++, 64, $line , 'text' ); } // Copy other test files from simpletest. $original = \Drupal::root() . '/core/tests/fixtures/files' ; $files = \Drupal::service( 'file_system' )->scanDirectory( $original , '/(html|image|javascript|php|sql)-.*/' ); foreach ( $files as $file ) { |
12.08.2019
lazyloader 8.x-1.x-dev ::
tests/src/Kernel/ThemeTest.php
$count = 0; foreach ( $lines as $line ) { $this ->generateFile( 'text-' . $count ++, 64, $line , 'text' ); } // Copy other test files from fixtures. $original = \Drupal::root() . '/core/tests/fixtures/files' ; $files = $file_system ->scanDirectory( $original , '/(html|image|javascript|php|sql)-.*/' ); foreach ( $files as $file ) { |
* The filename of the generated file. */ public static function generateFile( $filename , $width , $lines , $type = 'binary-text' ) { $text = '' ; for ( $i = 0; $i < $lines ; $i ++) { // Generate $width - 1 characters to leave space for the "\n" character. for ( $j = 0; $j < $width - 1; $j ++) { switch ( $type ) { case 'text' : |
23.10.2019
lionbridge_translation_provider 8.x-2.4 ::
src/Plugin/tmgmt/Translator/LionbridgeTranslator.php
$file_name = $this ->generateFileName( $job ->label(), $source_language , $target_language ); $file_asset = $this ->generateFile( $file_name , $source_language , $job ->getData(), $api_client ); if (isset( $file_asset [ 'Errors' ][ 'Error' ])) { throw new TMGMTException( $file_asset [ 'Errors' ][ 'Error' ][ 'DetailedMessage' ]); } $file_assets [] = $file_asset [ 'AssetID' ]; |
27.05.2020
migrate_media_handler 8.x-1.0-rc4 ::
tests/src/Kernel/Plugin/migrate/process/UpdateFileToAudioTest.php
// Instantiate file for media entity. $this ->testMediaFilename = 'test.wav' ; $file = $this ->generateFile(); $this ->assertInstanceOf(File:: class , $file , 'File not properly instantiated.' ); // Test basic audio creation. Can't skip target_bundle bco test constraints. $configuration = [ 'target_bundle' => $this ->testMediaType->id(), ]; |
public function testUpdateFileToAudioExtras() { // Instantiate file for media entity. $file = $this ->generateFile(); $this ->assertInstanceOf(File:: class , $file , 'File not properly instantiated.' ); // Test with alt and title. $configuration = [ 'source_field' => 'old_audio_field' , 'target_bundle' => $this ->testMediaType->id(), |
27.05.2020
migrate_media_handler 8.x-1.0-rc4 ::
tests/src/Kernel/Plugin/migrate/process/UpdateFileToImageTest.php
public function testUpdateFileToImageSimple() { // Instantiate file for media entity. $file = $this ->generateFile(); $this ->assertInstanceOf(File:: class , $file , 'File not properly instantiated.' ); // Test basic image creation. Can't skip target_bundle bco test constraints. $configuration = [ 'target_bundle' => $this ->testMediaType->id(), ]; |
public function testUpdateFileToImageExtras() { // Instantiate file for media entity. $file = $this ->generateFile(); $this ->assertInstanceOf(File:: class , $file , 'File not properly instantiated.' ); // Test with alt and title. $configuration = [ 'source_field' => 'old_image_field' , 'target_bundle' => $this ->testMediaType->id(), |
27.05.2020
migrate_media_handler 8.x-1.0-rc4 ::
tests/src/Kernel/Plugin/migrate/process/UpdateFileToDocumentTest.php
// Instantiate file for media entity. $this ->testMediaFilename = 'test.txt' ; $file = $this ->generateFile(); $this ->assertInstanceOf(File:: class , $file , 'File not properly instantiated.' ); // Test basic document creation. Can't skip target_bundle bco test constraints. $configuration = [ 'target_bundle' => $this ->testMediaType->id(), ]; |
public function testUpdateFileToDocumentExtras() { // Instantiate file for media entity. $file = $this ->generateFile(); $this ->assertInstanceOf(File:: class , $file , 'File not properly instantiated.' ); // Test with alt and title. $configuration = [ 'source_field' => 'old_document_field' , 'target_bundle' => $this ->testMediaType->id(), |
27.05.2020
migrate_media_handler 8.x-1.0-rc4 ::
tests/src/Kernel/MakeAudioEntityTest.php
$this ->testMediaFilename = 'test.wav' ; // Make & test file entity. $file = $this ->generateFile(); $this ->assertInstanceOf(File:: class , $file , 'File not properly instantiated.' ); // Make and test Document entity. $config = [ 'target_bundle' => $this ->testMediaType->id(), 'source_field' => 'old_audio_field' , |