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

Commit

Permalink
fix: Update factory trying unresolveable translator (#54)
Browse files Browse the repository at this point in the history
  • Loading branch information
fibble authored Feb 1, 2024
1 parent ebc7dfa commit 46ccb3b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
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

0 comments on commit 46ccb3b

Please sign in to comment.