ProjectUnitTest.php in Coder 8.2
File
coder_sniffer/DrupalPractice/Test/ProjectDetection/ProjectUnitTest.php
View source
<?php
namespace DrupalPractice\ProjectDetection;
use DrupalPractice\Project;
class ProjectUnitTest extends \PHPUnit_Framework_TestCase {
protected $phpcsFile;
public function setUp() {
parent::setUp();
$this->phpcsFile = $this
->getMockBuilder('PHP_CodeSniffer_File')
->disableOriginalConstructor()
->getMock();
}
public function testInfoFileDetection() {
$this
->markTestIncomplete('This test relies on code that has been removed in PHP_CodeSniffer 3.x.');
$this->phpcsFile
->expects($this
->any())
->method('getFilename')
->will($this
->returnValue(dirname(__FILE__) . '/modules/drupal6/test.php'));
$this
->assertEquals(Project::getInfoFile($this->phpcsFile), dirname(__FILE__) . '/modules/drupal6/testmodule.info');
}
public function testInfoFileNestedDetection() {
$this
->markTestIncomplete('This test relies on code that has been removed in PHP_CodeSniffer 3.x.');
$this->phpcsFile
->expects($this
->any())
->method('getFilename')
->will($this
->returnValue(dirname(__FILE__) . '/modules/drupal6/nested/test.php'));
$this
->assertEquals(Project::getInfoFile($this->phpcsFile), dirname(__FILE__) . '/modules/drupal6/testmodule.info');
}
public function testCoreVersion($filename, $core_version) {
$this
->markTestIncomplete('This test relies on code that has been removed in PHP_CodeSniffer 3.x.');
$this->phpcsFile
->expects($this
->any())
->method('getFilename')
->will($this
->returnValue($filename));
$this
->assertEquals(Project::getCoreVersion($this->phpcsFile), $core_version);
}
public function coreVersionProvider() {
return array(
array(
dirname(__FILE__) . '/modules/drupal6/nested/test.php',
'6.x',
),
array(
dirname(__FILE__) . '/modules/drupal7/test.php',
'7.x',
),
array(
dirname(__FILE__) . '/modules/drupal8/test.php',
'8.x',
),
);
}
}