Best Atoum code snippet using source.getSourceDirectory
CompilerTest.php
Source:CompilerTest.php
...18 $this->paths[] = $output = $this->getTempDir() . '/ck_output';19 $obj = new Compiler($source, $output);20 $this->assertFileExists($source);21 $this->assertFileExists($output);22 $this->assertEquals($source, $obj->getSourceDirectory());23 $this->assertEquals($output, $obj->getOutputDirectory());24 $obj = new Compiler;25 $dir = $this->getTempDir();26 $return = $obj->setSourceDirectory($dir);27 $this->assertInstanceOf('aklump\kit_php\Compiler', $return);28 $this->assertEquals($dir, $obj->getSourceDirectory());29 // Assert bad directory, no create returns empty30 $obj = new Compiler;31 $dir = '/some/dorky/directory/that/does/not/exist';32 $obj->setSourceDirectory($dir, FALSE);33 $this->assertEmpty($obj->getSourceDirectory());34 // Assert no directory, create true, creates and returns it.35 $obj = new Compiler;36 $this->paths[] = $dir = $this->getTempDir() . '/kit';37 $obj->setSourceDirectory($dir);38 $this->assertEquals($dir, $obj->getSourceDirectory());39 $this->assertFileExists($dir);40 $obj = new Compiler;41 $dir = $this->getTempDir();42 $return = $obj->setOutputDirectory($dir);43 $this->assertInstanceOf('aklump\kit_php\Compiler', $return);44 $this->assertEquals($dir, $obj->getOutputDirectory());45 // Assert bad directory, no create returns empty46 $obj = new Compiler;47 $dir = '/some/dorky/directory/that/does/not/exist';48 $obj->setOutputDirectory($dir, FALSE);49 $this->assertEmpty($obj->getOutputDirectory());50 // Assert no directory, create true, creates and returns it.51 $obj = new Compiler;52 $this->paths[] = $dir = $this->getTempDir() . '/public_html';53 $obj->setOutputDirectory($dir);54 $this->assertEquals($dir, $obj->getOutputDirectory());55 $this->assertFileExists($dir);56 }57 public function testApply() {58 $this->paths['source'] = $this->getTempDir() . '/apply_source';59 $this->paths['output'] = $this->getTempDir() . '/apply_output';60 $obj = new Compiler($this->paths['source'], $this->paths['output']);61 // Set up three nested source .kit files62 $contents = <<<EOD63<!--\$header = 'Header'-->64<!--\$footer = 'Footer'-->65<!--\$preface = 'Four score and seven...'-->66<!--\$conclusion = 'Amen.'-->67<!--\$noun = 'donkey'-->68<!--\$place = 'Jerusalem'-->69<!--\$header-->70<!--@include body.kit-->71<!--\$footer-->72EOD;73 $this->writeFile($contents, 'page.kit', $this->paths['source']);74 $contents = <<<EOD75<!--\$preface-->76<!--@include content.kit-->77<!--\$conclusion-->78EOD;79 $this->writeFile($contents, 'body.kit', $this->paths['source']);80 $contents = <<<EOD81There was a <!--@noun-->, who lived in <!--@place-->.82EOD;83 $this->writeFile($contents, 'content.kit', $this->paths['source']);84 // Set up a non kit file to make sure it's ignored85 $this->writeFile('', 'bogus.html', $this->paths['source']);86 // Extract the files87 $control = array(88 'body.kit' => $this->paths['source'] . '/body.kit',89 'content.kit' => $this->paths['source'] . '/content.kit',90 'page.kit' => $this->paths['source'] . '/page.kit',91 );92 $this->assertEquals($control, $obj->getKitFiles());93 // Apply and check result94 $control = <<<EOD95Header96Four score and seven...97There was a donkey, who lived in Jerusalem.98Amen.99Footer100EOD;101 $this->assertEquals($control, $obj->apply());102 // Make sure we've not left any .kit.orig files behind103 $obj->__destruct();104 $files = scandir($this->paths['source']);105 $orphans = array();106 foreach ($files as $file) {107 if (preg_match('/(.*?\.kit)\.orig$/', $file, $matches)) {108 $orphans[] = $file;109 }110 }111 $this->assertEmpty($orphans);112 // Make sure the output files have .html extensions not .kit113 $files = scandir($this->paths['output']);114 $control = array('.', '..', 'page.html');115 $this->assertEquals($control, $files);116 }117 public function testRelativeDirs() {118 // Create three files in different dirs119 $index = $this->writeFile('<index><!-- @include ../core/tpl/header.kit --></index>', 'index.kit', 'kit');120 $header = $this->writeFile('<header><!-- @include nav.kit --></header>', 'header.kit', 'core/tpl');121 $nav = $this->writeFile('<nav>Here is the Navigation</nav>', 'nav.kit', 'core/tpl');122 $obj = new Compiler($this->getTempDir() . '/kit', $this->getTempDir() . '/public_html');123 $this->assertEquals('<index><header><nav>Here is the Navigation</nav></header></index>', $obj->apply());124 // Check imports125 $control = array(126 '../core/tpl/header.kit' => $obj->getSourceDirectory() . '/../core/tpl/header.kit',127 'nav.kit' => $obj->getSourceDirectory() . '/../core/tpl/nav.kit',128 );129 $this->assertEquals($control, $obj->getImports());130 // Check exports131 $control = array(132 'index.html' => $obj->getOutputDirectory() . '/index.html',133 );134 $this->assertEquals($control, $obj->getCompiledFiles());135 }136 public function testKitFilesInNestedDirs() {137 $this->writeFile('great-grandfather', 'great-grandfather.kit', 'nested');138 $this->writeFile('great-grandmother', 'great-grandmother.kit', 'nested');139 $this->writeFile('grandfather', 'grandfather.kit', 'nested/grandfather');140 $this->writeFile('father', 'father.kit', 'nested/grandfather/father');141 $this->writeFile('son', 'son.kit', 'nested/grandfather/father/children');...
Codebase.php
Source:Codebase.php
...53 /**54 * {@inheritdoc}55 */56 public function getModifiedPhpFiles() {57 $host_source_dir = $this->getSourceDirectory();58 $phpfiles = [];59 foreach ($this->modified_files as $file) {60 $file_path = $host_source_dir . "/" . $file;61 // Checking for: if not in a vendor dir, if the file still exists, and if the first 32 (length - 1) bytes of the file contain <?php62 if (file_exists($file_path)) {63 $isphpfile = strpos(fgets(fopen($file_path, 'r'), 33), '<?php') !== FALSE;64 $not_vendor = strpos($file, 'vendor/') === FALSE;65 $not_phar = strpos($file, '.phar') === FALSE;66 if ($not_phar && $not_vendor && $isphpfile) {67 $phpfiles[] = $file;68 }69 }70 }71 return $phpfiles;72 }73 public function addModifiedFile($filename) {74 // Codebase' modified files should be a relative path and not75 // contain the host or container environments' source path.76 if (substr($filename, 0, strlen($this->getSourceDirectory())) == $this->getSourceDirectory()) {77 $filename = substr($filename, strlen($this->getSourceDirectory()) + 1);78 }79 if (!in_array($filename, $this->modified_files)) {80 $this->modified_files[] = $filename;81 }82 }83 public function addModifiedFiles($files) {84 foreach ($files as $file) {85 $this->addModifiedFile($file);86 }87 }88 /**89 * @inheritDoc90 */91 public function getSourceDirectory() {92 return $this->build->getSourceDirectory();93 }94 /**95 * {@inheritdoc}96 */97 public function getProjectName() {98 return $this->projectName;99 }100 /**101 * {@inheritdoc}102 */103 public function setProjectName($projectName) {104 $this->projectName = $projectName;105 }106 /**107 * @inheritDoc108 */109 public function getProjectType() {110 return $this->projectType;111 }112 /**113 * @inheritDoc114 */115 public function setProjectType($projectType) {116 $this->projectType = $projectType;117 }118 /**119 * @inheritDoc120 */121 public function getExtensionProjectSubdir() {122 return $this->extensionProjectSubDirectory;123 }124 /**125 * @param string $extensionProjectDir126 */127 public function setExtensionProjectSubdir($extensionProjectDir) {128 $this->extensionProjectSubDirectory = $extensionProjectDir;129 }130 /**131 * @return string132 */133 public function getExtensionPaths() {134 return $this->extensionPaths;135 }136 /**137 * @param string $extensionPaths138 */139 public function setExtensionPaths($extensionPaths) {140 $this->extensionPaths = $extensionPaths;141 }142 /**143 * Returns a list of require-dev packages for the current project.144 *145 * @return array146 */147 public function getComposerDevRequirements() {148 $packages = [];149 $installed_json = $this->getInstalledComposerPackages();150 foreach ($installed_json as $package) {151 if ($package['name'] == "drupal/" . $this->projectName) {152 if (!empty($package['require-dev'])) {153 $this->io->writeln("<error>Adding testing (require-dev) dependencies.</error>");154 foreach ($package['require-dev'] as $dev_package => $constraint) {155 $packages[] = escapeshellarg($dev_package . ":" . $constraint);156 }157 }158 }159 }160 return $packages;161 }162 public function getInstalledComposerPackages() {163 $installed_json = [];164 $install_json = $this->getSourceDirectory() . '/vendor/composer/installed.json';165 if (file_exists($install_json)) {166 $installed_json = json_decode(file_get_contents($install_json), TRUE);167 }168 return $installed_json;169 }170 /**171 * {@inheritdoc}172 */173 public function getProjectSourceDirectory($absolute = TRUE) {174 $project_type = $this->getProjectType();175 if ($project_type == 'core') {176 $project_dir = '';177 } else {178 $project_dir = "{$this->extensionPaths[$project_type]}/{$this->projectName}";179 }180 if ($absolute) {181 return "{$this->getSourceDirectory()}/{$project_dir}";182 } else {183 return $project_dir;184 }185 }186 /**187 * {@inheritdoc}188 */189 public function getProjectConfigDirectory($absolute = TRUE) {190 if ($this->getProjectType() == 'core') {191 if ($absolute) {192 return "{$this->getProjectSourceDirectory($absolute)}/core";193 } else {194 return 'core';195 }...
Theme.php
Source:Theme.php
...30 * Get the source directory31 *32 * @return string33 */34 public function getSourceDirectory()35 {36 return Mage::getModuleDir('', 'Fishpig_Wordpress') . DS . 'wptheme' . DS;37 }38 39 /**40 * Install the theme41 * 42 * @return bool43 */44 public function install()45 {46 $themeDirectory = $this->getThemeDirectory();47 $sourceDirectory = $this->getSourceDirectory();48 49 if (!is_dir($themeDirectory)) {50 if (!$this->_installTheme()) {51 throw new Exception('Unable to create the theme in WordPress.');52 }53 }54 55 if (!is_file($themeDirectory . 'style.css')) {56 $this->_installThemeFiles();57 }58 else if (version_compare($this->_getVersion($sourceDirectory . 'style.css'), $this->_getVersion($themeDirectory . 'style.css'), '>')) {59 $this->_installThemeFiles();60 }61 62 return is_dir($themeDirectory);63 }64 /*65 * install the theme66 *67 * @return $this68 */69 protected function _installTheme()70 {71 $themeDirectory = $this->getThemeDirectory(); 72 $sourceDirectory = $this->getSourceDirectory();73 if (!is_dir($sourceDirectory)) {74 throw new Exception('Theme source directory does not exist at ' . $sourceDirectory);75 }76 if (!is_dir($themeDirectory)) {77 @mkdir($themeDirectory, 0755, true);78 79 if (!is_dir($themeDirectory)) {80 throw new Exception('Unable to create theme directory at ' . $themeDirectory);81 }82 83 $this->_installThemeFiles();84 }85 86 return is_dir($themeDirectory);87 }88 89 /*90 * Copy theme files from source to target91 *92 * @return $this93 */94 protected function _installThemeFiles()95 {96 $themeDirectory = $this->getThemeDirectory(); 97 $sourceDirectory = $this->getSourceDirectory();98 99 if ($files = scandir($sourceDirectory)) {100 array_shift($files);101 array_shift($files);102 foreach($files as $file) {103 @copy($sourceDirectory . $file, $themeDirectory . $file);104 }105 }106 107 return $this;108 }109 110 /**111 * Determine whether a the WordPress theme is enabled...
getSourceDirectory
Using AI Code Generation
1$source = new Source();2echo $source->getSourceDirectory();3$source = new Source();4echo $source->getSourceDirectory();5$source = new Source();6echo $source->getSourceDirectory();7$source = new Source();8echo $source->getSourceDirectory();9$source = new Source();10echo $source->getSourceDirectory();11$source = new Source();12echo $source->getSourceDirectory();13$source = new Source();14echo $source->getSourceDirectory();15$source = new Source();16echo $source->getSourceDirectory();17$source = new Source();18echo $source->getSourceDirectory();19$source = new Source();20echo $source->getSourceDirectory();21$source = new Source();22echo $source->getSourceDirectory();23$source = new Source();24echo $source->getSourceDirectory();25$source = new Source();26echo $source->getSourceDirectory();27$source = new Source();28echo $source->getSourceDirectory();29$source = new Source();30echo $source->getSourceDirectory();31$source = new Source();32echo $source->getSourceDirectory();
getSourceDirectory
Using AI Code Generation
1$source = new Source();2echo $source->getSourceDirectory();3$source = new Source();4echo $source->getSourceDirectory();5$source = new Source();6echo $source->getSourceDirectory();7class Source {8 const SOURCE_DIRECTORY = 'C:\xampp\htdocs\PHP\OOP\static';9 public static function getSourceDirectory() {
getSourceDirectory
Using AI Code Generation
1$source = new Source();2$source->getSourceDirectory();3$source = new Source();4$source->getSourceDirectory();5$source = new Source();6$source->getSourceDirectory();
getSourceDirectory
Using AI Code Generation
1require_once 'source.php';2$source = new source();3echo $source->getSourceDirectory();4require_once 'source.php';5$source = new source();6echo $source->getSourceDirectory();7require_once 'source.php';8$source = new source();9echo $source->getSourceDirectory();10class classname {11 public static function methodname() {12 }13}14class source {15 public static function getSourceDirectory() {16 return getcwd();17 }18}19require_once 'source.php';20echo source::getSourceDirectory();21require_once 'source.php';22echo source::getSourceDirectory();23require_once 'source.php';24echo source::getSourceDirectory();
getSourceDirectory
Using AI Code Generation
1include_once 'source.php';2$source = new Source();3echo $source->getSourceDirectory();4include_once 'source.php';5$source = new Source();6echo $source->getSourceDirectory();7include_once 'source.php';8$source = new Source();9echo $source->getSourceDirectory();10include_once 'source.php';11$source = new Source();12echo $source->getSourceDirectory();13include_once 'source.php';14$source = new Source();15echo $source->getSourceDirectory();16include_once 'source.php';17$source = new Source();18echo $source->getSourceDirectory();19include_once 'source.php';20$source = new Source();21echo $source->getSourceDirectory();22include_once 'source.php';23$source = new Source();24echo $source->getSourceDirectory();25include_once 'source.php';26$source = new Source();27echo $source->getSourceDirectory();28include_once 'source.php';29$source = new Source();30echo $source->getSourceDirectory();31include_once 'source.php';32$source = new Source();33echo $source->getSourceDirectory();34include_once 'source.php';35$source = new Source();36echo $source->getSourceDirectory();37include_once 'source.php';38$source = new Source();39echo $source->getSourceDirectory();40include_once 'source.php';41$source = new Source();
getSourceDirectory
Using AI Code Generation
1require_once 'Source.php';2$source = new Source;3$source->getSourceDirectory();4require_once 'Source.php';5$source = new Source;6$source->getSourceDirectory();7require_once 'Source.php';8$source = new Source;9$source->getSourceDirectory();10require_once 'Source.php';11$source = new Source;12$source->getSourceDirectory();13require_once 'Source.php';14$source = new Source;15$source->getSourceDirectory();16require_once 'Source.php';17$source = new Source;18$source->getSourceDirectory();19require_once 'Source.php';20$source = new Source;21$source->getSourceDirectory();22require_once 'Source.php';23$source = new Source;24$source->getSourceDirectory();25require_once 'Source.php';26$source = new Source;27$source->getSourceDirectory();28require_once 'Source.php';29$source = new Source;30$source->getSourceDirectory();31require_once 'Source.php';32$source = new Source;33$source->getSourceDirectory();34require_once 'Source.php';35$source = new Source;36$source->getSourceDirectory();37require_once 'Source.php';38$source = new Source;39$source->getSourceDirectory();40require_once 'Source.php';41$source = new Source;42$source->getSourceDirectory();
getSourceDirectory
Using AI Code Generation
1require_once 'Source.php';2$source = new Source();3echo $source->getSourceDirectory();4require_once 'Source.php';5$source = new Source();6echo $source->getSourceDirectory();7require_once 'Source.php';8$source = new Source();9echo $source->getSourceDirectory();10require_once 'Source.php';11$source = new Source();12echo $source->getSourceDirectory();13require_once 'Source.php';14$source = new Source();15echo $source->getSourceDirectory();16require_once 'Source.php';17$source = new Source();18echo $source->getSourceDirectory();19require_once 'Source.php';20$source = new Source();21echo $source->getSourceDirectory();22require_once 'Source.php';23$source = new Source();24echo $source->getSourceDirectory();
getSourceDirectory
Using AI Code Generation
1$source = new source();2echo $source->getSourceDirectory();3$source = new source();4echo $source->getSourceDirectory();5$source = new source();6echo $source->getSourceDirectory();7$source = new source();8echo $source->getSourceDirectory();9$source = new source();10echo $source->getSourceDirectory();11$source = new source();12echo $source->getSourceDirectory();13$source = new source();14echo $source->getSourceDirectory();15$source = new source();16echo $source->getSourceDirectory();17$source = new source();
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Execute automation tests with getSourceDirectory on a cloud-based Grid of 3000+ real browsers and operating systems for both web and mobile applications.
Test now for FreeGet 100 minutes of automation test minutes FREE!!