Skip to content
This repository has been archived by the owner on Aug 16, 2024. It is now read-only.

fix: Update factory trying unresolveable translator. #54

Merged
merged 1 commit into from
Feb 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

namespace Olcs\View\Helper;

use Interop\Container\ContainerInterface;
use Common\Service\Helper\TranslationHelperService;
use Laminas\ServiceManager\Factory\FactoryInterface;
use Psr\Container\ContainerInterface;

class SubmissionSectionMultipleTablesFactory implements FactoryInterface
{
Expand All @@ -17,7 +18,7 @@ class SubmissionSectionMultipleTablesFactory implements FactoryInterface
*/
public function __invoke(ContainerInterface $container, $requestedName, array $options = null): SubmissionSectionMultipleTables
{
$translator = $container->get('Translator');
$translator = $container->get(TranslationHelperService::class);
$service = new SubmissionSectionMultipleTables();
$service->setTranslator($translator);
return $service;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace OlcsTest\View\Helper;

use Common\Service\Helper\TranslationHelperService;
use Interop\Container\ContainerInterface;
use Mockery\Adapter\Phpunit\MockeryTestCase;
use Olcs\View\Helper\SubmissionSectionMultipleTables;
Expand All @@ -12,10 +13,10 @@ class SubmissionSectionMultipleTablesFactoryTest extends MockeryTestCase
{
public function testInvoke()
{
$mockTranslator = m::mock('\Laminas\I18n\Translator\Translator');
$mockTranslator = m::mock(TranslationHelperService::class);

$mockServiceLocator = m::mock(ContainerInterface::class);
$mockServiceLocator->shouldReceive('get')->with('Translator')
$mockServiceLocator->shouldReceive('get')->with(TranslationHelperService::class)
->andReturn($mockTranslator);

$sut = new SubmissionSectionMultipleTablesFactory();
Expand Down
Loading