mirror of
https://github.com/elicpeter/nyx.git
synced 2026-06-15 20:05:13 +02:00
refactor(dynamic): add recursive dependency resolution for SSA receivers, expand tests for Python and PHP
This commit is contained in:
parent
f49211d788
commit
baa9a36bc6
13 changed files with 329 additions and 76 deletions
|
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
// Benign control for recursive typed ClassMethod dependencies.
|
||||
|
||||
class Repository {
|
||||
private $dbConnection;
|
||||
|
||||
public function __construct($dbConnection) {
|
||||
$this->dbConnection = $dbConnection;
|
||||
}
|
||||
|
||||
public function run($payload) {
|
||||
return 'ok';
|
||||
}
|
||||
}
|
||||
|
||||
class Service {
|
||||
private Repository $repository;
|
||||
|
||||
public function __construct(Repository $repository) {
|
||||
$this->repository = $repository;
|
||||
}
|
||||
|
||||
public function run($payload) {
|
||||
return $this->repository->run($payload);
|
||||
}
|
||||
}
|
||||
|
||||
class UserController {
|
||||
private Service $service;
|
||||
|
||||
public function __construct(Service $service) {
|
||||
$this->service = $service;
|
||||
}
|
||||
|
||||
public function run($payload) {
|
||||
return $this->service->run($payload);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
// Class-method fixture with recursively constructed typed dependencies.
|
||||
|
||||
class Repository {
|
||||
private $dbConnection;
|
||||
|
||||
public function __construct($dbConnection) {
|
||||
$this->dbConnection = $dbConnection;
|
||||
}
|
||||
|
||||
public function run($payload) {
|
||||
return shell_exec('true ' . $payload);
|
||||
}
|
||||
}
|
||||
|
||||
class Service {
|
||||
private Repository $repository;
|
||||
|
||||
public function __construct(Repository $repository) {
|
||||
$this->repository = $repository;
|
||||
}
|
||||
|
||||
public function run($payload) {
|
||||
return $this->repository->run($payload);
|
||||
}
|
||||
}
|
||||
|
||||
class UserController {
|
||||
private Service $service;
|
||||
|
||||
public function __construct(Service $service) {
|
||||
$this->service = $service;
|
||||
}
|
||||
|
||||
public function run($payload) {
|
||||
return $this->service->run($payload);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
"""Benign control for the recursive ClassMethod dependency fixture."""
|
||||
|
||||
|
||||
class Repository:
|
||||
def __init__(self, db_connection):
|
||||
self._db = db_connection
|
||||
|
||||
def run(self, payload):
|
||||
return "ok"
|
||||
|
||||
|
||||
class Service:
|
||||
def __init__(self, repository: Repository):
|
||||
self._repository = repository
|
||||
|
||||
def run(self, payload):
|
||||
return self._repository.run(payload)
|
||||
|
||||
|
||||
class UserController:
|
||||
def __init__(self, service: Service):
|
||||
self._service = service
|
||||
|
||||
def run(self, payload):
|
||||
return self._service.run(payload)
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
"""Class-method fixture with recursively constructed dependencies."""
|
||||
|
||||
import os
|
||||
|
||||
|
||||
class Repository:
|
||||
def __init__(self, db_connection):
|
||||
self._db = db_connection
|
||||
|
||||
def run(self, payload):
|
||||
os.system(payload)
|
||||
|
||||
|
||||
class Service:
|
||||
def __init__(self, repository: Repository):
|
||||
self._repository = repository
|
||||
|
||||
def run(self, payload):
|
||||
self._repository.run(payload)
|
||||
|
||||
|
||||
class UserController:
|
||||
def __init__(self, service: Service):
|
||||
self._service = service
|
||||
|
||||
def run(self, payload):
|
||||
self._service.run(payload)
|
||||
Loading…
Add table
Add a link
Reference in a new issue