Add PHP Analyzer Plugin and Composer Lock Data Handling
Some checks failed
Docs CI / lint-and-preview (push) Has been cancelled
Some checks failed
Docs CI / lint-and-preview (push) Has been cancelled
- Implemented the PhpAnalyzerPlugin to analyze PHP projects. - Created ComposerLockData class to represent data from composer.lock files. - Developed ComposerLockReader to load and parse composer.lock files asynchronously. - Introduced ComposerPackage class to encapsulate package details. - Added PhpPackage class to represent PHP packages with metadata and evidence. - Implemented PhpPackageCollector to gather packages from ComposerLockData. - Created PhpLanguageAnalyzer to perform analysis and emit results. - Added capability signals for known PHP frameworks and CMS. - Developed unit tests for the PHP language analyzer and its components. - Included sample composer.lock and expected output for testing. - Updated project files for the new PHP analyzer library and tests.
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
using System.Collections.Immutable;
|
||||
using Microsoft.Extensions.Logging.Abstractions;
|
||||
using StellaOps.Graph.Indexer.Analytics;
|
||||
|
||||
namespace StellaOps.Graph.Indexer.Tests;
|
||||
|
||||
public sealed class GraphAnalyticsPipelineTests
|
||||
{
|
||||
[Fact]
|
||||
public async Task RunAsync_WritesClustersAndCentrality()
|
||||
{
|
||||
var snapshot = GraphAnalyticsTestData.CreateLinearSnapshot();
|
||||
|
||||
var provider = new InMemoryGraphSnapshotProvider();
|
||||
provider.Enqueue(snapshot);
|
||||
|
||||
using var metrics = new GraphAnalyticsMetrics();
|
||||
var writer = new InMemoryGraphAnalyticsWriter();
|
||||
var pipeline = new GraphAnalyticsPipeline(
|
||||
new GraphAnalyticsEngine(new GraphAnalyticsOptions()),
|
||||
provider,
|
||||
writer,
|
||||
metrics,
|
||||
NullLogger<GraphAnalyticsPipeline>.Instance);
|
||||
|
||||
await pipeline.RunAsync(new GraphAnalyticsRunContext(false), CancellationToken.None);
|
||||
|
||||
Assert.Single(writer.ClusterWrites);
|
||||
Assert.Single(writer.CentralityWrites);
|
||||
Assert.Equal(snapshot.Nodes.Length, writer.ClusterWrites.Single().Assignments.Length);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user