Skip to content

Commit

Permalink
fix: fix php query not capturing object_creation_expression #368
Browse files Browse the repository at this point in the history
  • Loading branch information
benedikt-mehl-mw authored and mylinhdao committed Jun 3, 2024
1 parent bf730b9 commit 2818088
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/parser/resolver/call-expressions/php-collector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export class PHPCollector extends AbstractCollector {
type: (_) @qualified_name
)
(object_creation_expression
(qualified_name) @qualified_name
(name) @qualified_name
)
(class_constant_access_expression
(qualified_name) @call_expression
Expand Down
24 changes: 12 additions & 12 deletions test/metric-end-results/__snapshots__/php-metrics.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ exports[`PHP metrics tests > parsing PHP dependencies > should calculate the rig
"outgoing_dependencies": 2,
},
"Library\\Helper.php" => {
"coupling_between_objects": 4,
"incoming_dependencies": 3,
"instability": 0.25,
"coupling_between_objects": 6,
"incoming_dependencies": 5,
"instability": 0.16666666666666666,
"outgoing_dependencies": 1,
},
"Library\\HelperOutput.php" => {
Expand Down Expand Up @@ -101,15 +101,6 @@ exports[`PHP metrics tests > parsing PHP dependencies > should calculate the rig
"toSource": "BlubController.php",
"usageType": "extends",
},
{
"fromClassName": "BlubControllerTwo1",
"fromNamespace": "App\\CouplingExamplesTwo\\BlubControllerTwo1",
"fromSource": "BlubController.php",
"toClassName": "Helper",
"toNamespace": "App\\CouplingExamples\\Library\\Helper",
"toSource": "Library\\Helper.php",
"usageType": "usage",
},
{
"fromClassName": "AnotherControllerOne",
"fromNamespace": "App\\CouplingExamplesOne\\AnotherControllerOne",
Expand Down Expand Up @@ -137,6 +128,15 @@ exports[`PHP metrics tests > parsing PHP dependencies > should calculate the rig
"toSource": "Library\\Helper.php",
"usageType": "usage",
},
{
"fromClassName": "BlubControllerTwo1",
"fromNamespace": "App\\CouplingExamplesTwo\\BlubControllerTwo1",
"fromSource": "BlubController.php",
"toClassName": "Helper",
"toNamespace": "App\\CouplingExamples\\Library\\Helper",
"toSource": "Library\\Helper.php",
"usageType": "usage",
},
{
"fromClassName": "HelperOutput",
"fromNamespace": "App\\CouplingExamples\\Library\\HelperOutput",
Expand Down
2 changes: 1 addition & 1 deletion test/metric-end-results/php-metrics.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ describe("PHP metrics tests", () => {
});

describe("parsing PHP dependencies", () => {
it.skip("should calculate the right dependencies and coupling metrics", async () => {
it("should calculate the right dependencies and coupling metrics", async () => {
mockConsole();
mockWin32Path({ skip: ["join", "resolve", "normalize"] });
const couplingResult = await getCouplingMetrics(
Expand Down

0 comments on commit 2818088

Please sign in to comment.