/**
  * Test that text collector can detect module file lists properly
  */
 public function testModuleFileList()
 {
     $collector = new i18nTextCollectorTest_Collector();
     $collector->basePath = $this->alternateBasePath;
     $collector->baseSavePath = $this->alternateBaseSavePath;
     // Non-standard modules can't be safely filtered, so just index everything
     $nonStandardFiles = $collector->getFileListForModule_Test('i18nnonstandardmodule');
     $nonStandardRoot = $this->alternateBasePath . '/i18nnonstandardmodule';
     $this->assertEquals(3, count($nonStandardFiles));
     $this->assertArrayHasKey("{$nonStandardRoot}/_config.php", $nonStandardFiles);
     $this->assertArrayHasKey("{$nonStandardRoot}/phpfile.php", $nonStandardFiles);
     $this->assertArrayHasKey("{$nonStandardRoot}/template.ss", $nonStandardFiles);
     // Normal module should have predictable dir structure
     $testFiles = $collector->getFileListForModule_Test('i18ntestmodule');
     $testRoot = $this->alternateBasePath . '/i18ntestmodule';
     $this->assertEquals(7, count($testFiles));
     // Code in code folder is detected
     $this->assertArrayHasKey("{$testRoot}/code/i18nTestModule.php", $testFiles);
     $this->assertArrayHasKey("{$testRoot}/code/subfolder/_config.php", $testFiles);
     $this->assertArrayHasKey("{$testRoot}/code/subfolder/i18nTestSubModule.php", $testFiles);
     $this->assertArrayHasKey("{$testRoot}/code/subfolder/i18nTestNamespacedClass.php", $testFiles);
     // Templates in templates folder is detected
     $this->assertArrayHasKey("{$testRoot}/templates/Includes/i18nTestModuleInclude.ss", $testFiles);
     $this->assertArrayHasKey("{$testRoot}/templates/Layout/i18nTestModule.ss", $testFiles);
     $this->assertArrayHasKey("{$testRoot}/templates/i18nTestModule.ss", $testFiles);
     // Standard modules with code in odd places should only have code in those directories detected
     $otherFiles = $collector->getFileListForModule_Test('i18nothermodule');
     $otherRoot = $this->alternateBasePath . '/i18nothermodule';
     $this->assertEquals(3, count($otherFiles));
     // Only detect well-behaved files
     $this->assertArrayHasKey("{$otherRoot}/code/i18nOtherModule.php", $otherFiles);
     $this->assertArrayHasKey("{$otherRoot}/code/i18nTestModuleDecorator.php", $otherFiles);
     $this->assertArrayHasKey("{$otherRoot}/templates/i18nOtherModule.ss", $otherFiles);
     // Themes should detect all ss files only
     $theme1Files = $collector->getFileListForModule_Test('themes/testtheme1');
     $theme1Root = $this->alternateBasePath . '/themes/testtheme1/templates';
     $this->assertEquals(3, count($theme1Files));
     // Find only ss files
     $this->assertArrayHasKey("{$theme1Root}/Includes/i18nTestTheme1Include.ss", $theme1Files);
     $this->assertArrayHasKey("{$theme1Root}/Layout/i18nTestTheme1.ss", $theme1Files);
     $this->assertArrayHasKey("{$theme1Root}/i18nTestTheme1Main.ss", $theme1Files);
     // Only 1 file here
     $theme2Files = $collector->getFileListForModule_Test('themes/testtheme2');
     $this->assertEquals(1, count($theme2Files));
     $this->assertArrayHasKey($this->alternateBasePath . '/themes/testtheme2/templates/i18nTestTheme2.ss', $theme2Files);
 }