|
@@ -76,6 +76,7 @@ final class FixerFactoryTest extends TestCase
|
|
|
[$fixers['declare_strict_types'], $fixers['blank_line_after_opening_tag']],
|
|
|
[$fixers['declare_strict_types'], $fixers['declare_equal_normalize']],
|
|
|
[$fixers['declare_strict_types'], $fixers['single_blank_line_before_namespace']],
|
|
|
+ [$fixers['doctrine_annotation_array_assignment'], $fixers['doctrine_annotation_spaces']],
|
|
|
[$fixers['elseif'], $fixers['braces']],
|
|
|
[$fixers['escape_implicit_backslashes'], $fixers['heredoc_to_nowdoc']],
|
|
|
[$fixers['escape_implicit_backslashes'], $fixers['single_quote']],
|
|
@@ -143,6 +144,7 @@ final class FixerFactoryTest extends TestCase
|
|
|
[$fixers['ordered_class_elements'], $fixers['method_separation']],
|
|
|
[$fixers['ordered_class_elements'], $fixers['no_blank_lines_after_class_opening']],
|
|
|
[$fixers['ordered_class_elements'], $fixers['space_after_semicolon']],
|
|
|
+ [$fixers['php_unit_construct'], $fixers['php_unit_dedicate_assert']],
|
|
|
[$fixers['php_unit_fqcn_annotation'], $fixers['no_unused_imports']],
|
|
|
[$fixers['php_unit_fqcn_annotation'], $fixers['php_unit_ordered_covers']],
|
|
|
[$fixers['php_unit_no_expectation_annotation'], $fixers['no_empty_phpdoc']],
|
|
@@ -307,13 +309,79 @@ final class FixerFactoryTest extends TestCase
|
|
|
);
|
|
|
}
|
|
|
|
|
|
+ public function testPriorityIntegrationTestFilesAreListedPriorityCases()
|
|
|
+ {
|
|
|
+ $priorityCases = [];
|
|
|
+ foreach ($this->provideFixersPriorityCases() as $priorityCase) {
|
|
|
+ $fixerName = $priorityCase[0]->getName();
|
|
|
+ if (!isset($priorityCases[$fixerName])) {
|
|
|
+ $priorityCases[$fixerName] = [];
|
|
|
+ }
|
|
|
+
|
|
|
+ $priorityCases[$fixerName][$priorityCase[1]->getName()] = true;
|
|
|
+ }
|
|
|
+
|
|
|
+ foreach (new \DirectoryIterator($this->getIntegrationPriorityDirectory()) as $candidate) {
|
|
|
+ if ($candidate->isDot()) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ $fileName = $candidate->getFilename();
|
|
|
+ $this->assertTrue($candidate->isFile(), sprintf('Expected only files in the priority integration test directory, got "%s".', $fileName));
|
|
|
+ $this->assertFalse($candidate->isLink(), sprintf('No (sym)links expected the priority integration test directory, got "%s".', $fileName));
|
|
|
+
|
|
|
+ if (in_array($fileName, [
|
|
|
+ 'braces,indentation_type,no_break_comment.test',
|
|
|
+ ], true)) {
|
|
|
+ $this->markTestIncomplete(sprintf('Case "%s" has unexpected name, please help fixing it.', $fileName));
|
|
|
+ }
|
|
|
+
|
|
|
+ $this->assertSame(
|
|
|
+ 1,
|
|
|
+ preg_match('#^([a-z][a-z0-9_]*),([a-z][a-z_]*)(?:_\d{1,3})?\.test$#', $fileName, $matches),
|
|
|
+ sprintf('File with unexpected name "%s" in the priority integration test directory.', $fileName)
|
|
|
+ );
|
|
|
+
|
|
|
+ $fixerName1 = $matches[1];
|
|
|
+ $fixerName2 = $matches[2];
|
|
|
+
|
|
|
+ $this->assertTrue(
|
|
|
+ isset($priorityCases[$fixerName1][$fixerName2]) || isset($priorityCases[$fixerName2][$fixerName1]),
|
|
|
+ sprintf('Missing priority test entry for file "%s".', $fileName)
|
|
|
+ );
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @param FixerInterface $first
|
|
|
+ * @param FixerInterface $second
|
|
|
+ *
|
|
|
+ * @return string
|
|
|
+ */
|
|
|
private function generateIntegrationTestName(FixerInterface $first, FixerInterface $second)
|
|
|
{
|
|
|
return "{$first->getName()},{$second->getName()}.test";
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * @param FixerInterface $first
|
|
|
+ * @param FixerInterface $second
|
|
|
+ *
|
|
|
+ * @return bool
|
|
|
+ */
|
|
|
private function doesIntegrationTestExist(FixerInterface $first, FixerInterface $second)
|
|
|
{
|
|
|
- return is_file(__DIR__.'/../Fixtures/Integration/priority/'.$this->generateIntegrationTestName($first, $second)) || is_file(__DIR__.'/../Fixtures/Integration/priority/'.$this->generateIntegrationTestName($second, $first));
|
|
|
+ return
|
|
|
+ is_file($this->getIntegrationPriorityDirectory().$this->generateIntegrationTestName($first, $second))
|
|
|
+ || is_file($this->getIntegrationPriorityDirectory().$this->generateIntegrationTestName($second, $first))
|
|
|
+ ;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @return string
|
|
|
+ */
|
|
|
+ private function getIntegrationPriorityDirectory()
|
|
|
+ {
|
|
|
+ return __DIR__.'/../Fixtures/Integration/priority/';
|
|
|
}
|
|
|
}
|