Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
mrceperka committed Oct 24, 2022
1 parent d974449 commit f3f4fac
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions tests/cases/unit/SqlProcessorTest.backed_enum.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -37,23 +38,27 @@ class SqlProcessorBackedEnumTest extends TestCase
/** @var IPlatform|Mockery\MockInterface */
private $platform;

/** @var IDriver|Mockery\MockInterface */
private $driver;

/** @var SqlProcessor */
private $parser;


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);
}


public function testString()
{
$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));
}

Expand All @@ -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));

Expand Down

0 comments on commit f3f4fac

Please sign in to comment.