From f3f4fac73ada11353f95358c620c9c83c352c4ba Mon Sep 17 00:00:00 2001 From: mrceperka Date: Mon, 24 Oct 2022 11:52:24 +0200 Subject: [PATCH] fix test --- tests/cases/unit/SqlProcessorTest.backed_enum.phpt | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tests/cases/unit/SqlProcessorTest.backed_enum.phpt b/tests/cases/unit/SqlProcessorTest.backed_enum.phpt index 0354b52..74fdfb7 100644 --- a/tests/cases/unit/SqlProcessorTest.backed_enum.phpt +++ b/tests/cases/unit/SqlProcessorTest.backed_enum.phpt @@ -9,6 +9,7 @@ namespace NextrasTests\Dbal; use Mockery; +use Nextras\Dbal\Drivers\IDriver; use Nextras\Dbal\Exception\InvalidArgumentException; use Nextras\Dbal\Platforms\IPlatform; use Nextras\Dbal\SqlProcessor; @@ -37,6 +38,9 @@ class SqlProcessorBackedEnumTest extends TestCase /** @var IPlatform|Mockery\MockInterface */ private $platform; + /** @var IDriver|Mockery\MockInterface */ + private $driver; + /** @var SqlProcessor */ private $parser; @@ -44,8 +48,9 @@ class SqlProcessorBackedEnumTest extends TestCase protected function setUp() { parent::setUp(); + $this->driver = Mockery::mock(IDriver::class); $this->platform = \Mockery::mock(IPlatform::class); - $this->parser = new SqlProcessor($this->platform); + $this->parser = new SqlProcessor($this->driver, $this->platform); } @@ -53,7 +58,7 @@ class SqlProcessorBackedEnumTest extends TestCase { $cases = DirectionEnum::cases(); foreach ($cases as $case) { - $this->platform->shouldReceive('formatString')->once()->with($case->value)->andReturn('hit'); + $this->driver->shouldReceive('convertStringToSql')->once()->with($case->value)->andReturn('hit'); Assert::same('hit', $this->parser->processModifier('s', $case)); } @@ -75,7 +80,7 @@ class SqlProcessorBackedEnumTest extends TestCase { $cases = DirectionEnum::cases(); - $this->platform->shouldReceive('formatString')->times(count($cases)) + $this->driver->shouldReceive('convertStringToSql')->times(count($cases)) ->andReturnArg(0); Assert::same('(left, right)', $this->parser->processModifier('s[]', $cases));