Loading coder_sniffer/DrupalPractice/Test/ProjectDetection/ProjectUnitTest.php +65 −0 Original line number Diff line number Diff line Loading @@ -115,4 +115,69 @@ class ProjectUnitTest extends \PHPUnit_Framework_TestCase }//end coreVersionProvider() /** * Tests the extending classes Sniff class. * * @param string $filename Name of the file that will be checked. * @param string $projectname Expected project name for the file. * * @dataProvider projectNameDetectionProvider * * @return void */ public function testProjectNameDetection($filename, $projectname) { $this->phpcsFile->expects($this->any()) ->method('getFilename') ->will($this->returnValue($filename)); $this->assertEquals(Project::getName($this->phpcsFile), $projectname); }//end testProjectNameDetection() /** * Data provider for testProjectNameDetection(). * * @return array * An array of test cases, each test case an array with two elements: * - The filename to check. * - The expected project name. */ public function projectNameDetectionProvider() { return [ [ __DIR__.'/drupal6/testmodule.info', 'testmodule', ], [ __DIR__.'/drupal6/nested/test.php', 'testmodule', ], [ __DIR__.'/drupal7/testmodule.info', 'testmodule', ], [ __DIR__.'/drupal8/testmodule.info.yml', 'testmodule', ], [ __DIR__.'/drupal8/testtheme/testtheme.info.yml', 'testtheme', ], [ __DIR__.'/drupal8/testtheme/testtheme.theme', 'testtheme', ], [ 'invalid', false, ], ]; }//end projectNameDetectionProvider() }//end class coder_sniffer/DrupalPractice/Test/ProjectDetection/drupal8/testtheme/testtheme.info.yml 0 → 100644 +5 −0 Original line number Diff line number Diff line name: Test Theme description: A test theme for the DrupalPractice standard. package: Coder type: theme core: 8.x coder_sniffer/DrupalPractice/Test/ProjectDetection/drupal8/testtheme/testtheme.theme 0 → 100644 +5 −0 Original line number Diff line number Diff line <?php /** * Main functions and hook implementations of the test theme. */ Loading
coder_sniffer/DrupalPractice/Test/ProjectDetection/ProjectUnitTest.php +65 −0 Original line number Diff line number Diff line Loading @@ -115,4 +115,69 @@ class ProjectUnitTest extends \PHPUnit_Framework_TestCase }//end coreVersionProvider() /** * Tests the extending classes Sniff class. * * @param string $filename Name of the file that will be checked. * @param string $projectname Expected project name for the file. * * @dataProvider projectNameDetectionProvider * * @return void */ public function testProjectNameDetection($filename, $projectname) { $this->phpcsFile->expects($this->any()) ->method('getFilename') ->will($this->returnValue($filename)); $this->assertEquals(Project::getName($this->phpcsFile), $projectname); }//end testProjectNameDetection() /** * Data provider for testProjectNameDetection(). * * @return array * An array of test cases, each test case an array with two elements: * - The filename to check. * - The expected project name. */ public function projectNameDetectionProvider() { return [ [ __DIR__.'/drupal6/testmodule.info', 'testmodule', ], [ __DIR__.'/drupal6/nested/test.php', 'testmodule', ], [ __DIR__.'/drupal7/testmodule.info', 'testmodule', ], [ __DIR__.'/drupal8/testmodule.info.yml', 'testmodule', ], [ __DIR__.'/drupal8/testtheme/testtheme.info.yml', 'testtheme', ], [ __DIR__.'/drupal8/testtheme/testtheme.theme', 'testtheme', ], [ 'invalid', false, ], ]; }//end projectNameDetectionProvider() }//end class
coder_sniffer/DrupalPractice/Test/ProjectDetection/drupal8/testtheme/testtheme.info.yml 0 → 100644 +5 −0 Original line number Diff line number Diff line name: Test Theme description: A test theme for the DrupalPractice standard. package: Coder type: theme core: 8.x
coder_sniffer/DrupalPractice/Test/ProjectDetection/drupal8/testtheme/testtheme.theme 0 → 100644 +5 −0 Original line number Diff line number Diff line <?php /** * Main functions and hook implementations of the test theme. */