Skip to content

Commit

Permalink
code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
jwong-dayspring committed Aug 14, 2023
1 parent 199596e commit 42b6f7d
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 43 deletions.
5 changes: 2 additions & 3 deletions DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@ class Configuration implements ConfigurationInterface
/**
* {@inheritdoc}
*/
public function getConfigTreeBuilder()
public function getConfigTreeBuilder(): TreeBuilder
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('dayspring_lambda');
$treeBuilder = new TreeBuilder('dayspring_lambda');

// Here you should define the parameters that are allowed to
// configure your bundle. See the documentation linked above for
Expand Down
5 changes: 0 additions & 5 deletions Service/ServiceFunctionHandlerService.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,9 @@
namespace Dayspring\LambdaBundle\Service;

use Bref\Context\Context;
use Dayspring\LambdaBundle\Service\LambdaHandlerServiceInterface;
use Psr\Log\LoggerInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use function json_decode;
use function json_encode;
use function var_dump;
use function var_export;

class ServiceFunctionHandlerService implements LambdaHandlerServiceInterface
{
Expand Down
29 changes: 0 additions & 29 deletions Service/SqsServiceFunctionHandlerService.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,39 +3,10 @@
namespace Dayspring\LambdaBundle\Service;

use Bref\Context\Context;
use Dayspring\LambdaBundle\Service\LambdaHandlerServiceInterface;
use Psr\Log\LoggerInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use function is_a;
use function is_array;
use function json_decode;
use function json_encode;
use function var_dump;
use function var_export;

class SqsServiceFunctionHandlerService extends ServiceFunctionHandlerService
{

/** @var LoggerInterface $logger */
protected $logger;

/** @var ContainerInterface $container */
protected $container;


/**
* @param LoggerInterface $logger
* @param ContainerInterface $container
*/
public function __construct(
LoggerInterface $logger,
ContainerInterface $container
) {
$this->logger = $logger;
$this->container = $container;
}

public function init()
{
// nothing to init
Expand Down
17 changes: 11 additions & 6 deletions Tests/Service/EchoLambdaHandlerServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,28 @@

namespace Dayspring\LambdaBundle\Tests\Service;

class EchoLambdaHandlerServiceTest extends \PHPUnit\Framework\TestCase
use Bref\Context\Context;
use Dayspring\LambdaBundle\Service\EchoLambdaHandlerService;
use PHPUnit\Framework\TestCase;
use Psr\Log\LoggerInterface;
use Symfony\Component\Console\Output\BufferedOutput;

class EchoLambdaHandlerServiceTest extends TestCase
{

public function testHandle()
{
$logger = $this->createMock(\Psr\Log\LoggerInterface::class);
$logger = $this->createMock(LoggerInterface::class);

/** @var \Dayspring\LambdaBundle\Service\EchoLambdaHandlerService $service */
$service = new \Dayspring\LambdaBundle\Service\EchoLambdaHandlerService($logger);
$service = new EchoLambdaHandlerService($logger);

$context = new \Bref\Context\Context(
$context = new Context(
'request-id-1',
30*1000,
'my-function-arn',
'trace-id-1'
);
$output = new \Symfony\Component\Console\Output\BufferedOutput();
$output = new BufferedOutput();

$event = [
'body' => 'hello world'
Expand Down

0 comments on commit 42b6f7d

Please sign in to comment.