Skip to content

Commit

Permalink
fix mysql tests
Browse files Browse the repository at this point in the history
  • Loading branch information
prolic committed Mar 12, 2017
1 parent da1ebfa commit 0128e49
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 4 deletions.
17 changes: 13 additions & 4 deletions tests/Container/MySqlProjectionManagerFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use Prooph\EventStore\EventStore;
use Prooph\EventStore\Pdo\Container\MySqlProjectionManagerFactory;
use Prooph\EventStore\Pdo\Exception\InvalidArgumentException;
use Prooph\EventStore\Pdo\HasQueryHint;
use Prooph\EventStore\Pdo\MySqlEventStore;
use Prooph\EventStore\Pdo\PersistenceStrategy;
use Prooph\EventStore\Pdo\Projection\MySqlProjectionManager;
Expand All @@ -39,11 +40,15 @@ public function it_creates_service(): void

$connection = TestUtil::getConnection();

$messageFactory = $this->prophesize(MessageFactory::class);
$persistenceStrategy = $this->prophesize(PersistenceStrategy::class);
$persistenceStrategy->willImplement(HasQueryHint::class);

$container = $this->prophesize(ContainerInterface::class);
$eventStore = new MySqlEventStore(
$this->createMock(MessageFactory::class),
$messageFactory->reveal(),
TestUtil::getConnection(),
$this->createMock(PersistenceStrategy::class)
$persistenceStrategy->reveal()
);

$container->get('my_connection')->willReturn($connection)->shouldBeCalled();
Expand All @@ -67,11 +72,15 @@ public function it_creates_service_via_callstatic(): void

$connection = TestUtil::getConnection();

$messageFactory = $this->prophesize(MessageFactory::class);
$persistenceStrategy = $this->prophesize(PersistenceStrategy::class);
$persistenceStrategy->willImplement(HasQueryHint::class);

$container = $this->prophesize(ContainerInterface::class);
$eventStore = new MySqlEventStore(
$this->createMock(MessageFactory::class),
$messageFactory->reveal(),
TestUtil::getConnection(),
$this->createMock(PersistenceStrategy::class)
$persistenceStrategy->reveal()
);

$container->get('my_connection')->willReturn($connection)->shouldBeCalled();
Expand Down
18 changes: 18 additions & 0 deletions tests/MySqlEventStoreTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@
use Prooph\EventStore\Exception\ConcurrencyException;
use Prooph\EventStore\Metadata\MetadataMatcher;
use Prooph\EventStore\Metadata\Operator;
use Prooph\EventStore\Pdo\Exception\InvalidArgumentException;
use Prooph\EventStore\Pdo\Exception\RuntimeException;
use Prooph\EventStore\Pdo\MySqlEventStore;
use Prooph\EventStore\Pdo\PersistenceStrategy;
use Prooph\EventStore\Pdo\PersistenceStrategy\MySqlAggregateStreamStrategy;
use Prooph\EventStore\Pdo\PersistenceStrategy\MySqlSingleStreamStrategy;
use Prooph\EventStore\Stream;
Expand Down Expand Up @@ -53,6 +55,22 @@ protected function setUp(): void
);
}

/**
* @test
*/
public function it_requires_has_query_hint_implementation_for_persistence_strategy(): void
{
$this->expectException(InvalidArgumentException::class);

$persistenceStrategy = $this->prophesize(PersistenceStrategy::class);

new MySqlEventStore(
new FQCNMessageFactory(),
$this->connection,
$persistenceStrategy->reveal()
);
}

/**
* @test
*/
Expand Down

0 comments on commit 0128e49

Please sign in to comment.