From 59965448f0030c4b6f567dc44b23bd2aa4816ed1 Mon Sep 17 00:00:00 2001 From: Sara Itani Date: Mon, 10 Apr 2017 14:20:45 -0700 Subject: [PATCH] Update definition validation tests --- tests/Validation/ValidationTest.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tests/Validation/ValidationTest.php b/tests/Validation/ValidationTest.php index dd4e4da..aa87401 100644 --- a/tests/Validation/ValidationTest.php +++ b/tests/Validation/ValidationTest.php @@ -31,7 +31,7 @@ class ValidationTest extends TestCase $iterator = new RecursiveDirectoryIterator(__DIR__ . "/../../validation/frameworks/" . $frameworkName); foreach (new RecursiveIteratorIterator($iterator) as $file) { - if (strpos((string)$file, ".php") !== false && strpos((string)$file, "drupal") === false) { + if (strpos(\strrev((string)$file), \strrev(".php")) === 0) { if ($file->getSize() < 100000) { $testProviderArray[$frameworkName . "::" . $file->getBasename()] = [$file->getPathname(), $frameworkName]; } @@ -89,6 +89,7 @@ class ValidationTest extends TestCase $parserKinds = [ParserKind::DIAGNOSTIC_PHP_PARSER, ParserKind::DIAGNOSTIC_TOLERANT_PHP_PARSER]; $maxRecursion = []; $definitions = []; + $types = []; foreach ($parserKinds as $kind) { global $parserKind; @@ -106,17 +107,25 @@ class ValidationTest extends TestCase continue; } + if ($document->getStmts() === null) { + $this->markTestSkipped("null AST"); + } + $fqns = []; + $currentTypes = []; foreach ($document->getDefinitions() as $defn) { $fqns[] = $defn->fqn; + $currentTypes[$defn->fqn] = $defn->type; } if (isset($definitions[$testCaseFile])) { var_dump($definitions[$testCaseFile]); $this->assertEquals($definitions[$testCaseFile], $fqns); +// $this->assertEquals($types[$testCaseFile], $currentTypes); } $definitions[$testCaseFile] = $fqns; + $types[$testCaseFile] = $currentTypes; $maxRecursion[$testCaseFile] = $definitionResolver::$maxRecursion; } }