Skip to content

Commit

Permalink
Merge pull request #2 from prooph/restructure_docs
Browse files Browse the repository at this point in the history
Restructure docs
  • Loading branch information
codeliner authored Oct 15, 2017
2 parents 7a6b4a0 + 1821cdd commit dcd4045
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 6 deletions.
4 changes: 3 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,12 @@
"scripts": {
"check": [
"@cs",
"@test"
"@test",
"@docheader"
],
"cs": "php-cs-fixer fix -v --diff --dry-run",
"cs-fix": "php-cs-fixer fix -v --diff",
"docheader": "docheader check src/ tests/",
"test": "phpunit"
}
}
6 changes: 4 additions & 2 deletions docs/bookdown.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
{
"title": "Prooph Memcached SnapshotStore",
"title": "Memcached Snapshot Store",
"content": [
{"intro": "../README.md"},
{"intro": "introduction.md"},
{"interop_factories": "interop_factories.md"}
],
"tocDepth": 1,
"numbering": false,
"target": "./html",
"template": "../vendor/prooph/bookdown-template/templates/main.php"
}
13 changes: 13 additions & 0 deletions docs/introduction.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Overview

Memcached implementation of snapshot store

## Installation

```bash
composer require prooph/memcached-snapshot-store
```

## Requirements

- ext-memcached ^3.0
27 changes: 27 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false"
bootstrap="vendor/autoload.php"
>
<testsuite name="Prooph Memcached Snapshot Store Test Suite">
<directory>./tests/</directory>
</testsuite>

<filter>
<whitelist>
<directory>./src/</directory>
</whitelist>
</filter>

<php>
<var name="memcached_host" value="localhost" />
<var name="memcached_port" value="11211" />
</php>
</phpunit>
4 changes: 2 additions & 2 deletions src/MemcachedSnapshotStore.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public function save(Snapshot ...$snapshots): void
$snapshot->aggregateType(),
$snapshot->lastVersion(),
$snapshot->createdAt()->format('Y-m-d\TH:i:s.u'),
$this->serializer->serialize($snapshot->aggregateRoot())
$this->serializer->serialize($snapshot->aggregateRoot()),
];
}

Expand All @@ -82,7 +82,7 @@ public function removeAll(string $aggregateType): void
{
$keys = $this->connection->getAllKeys();

foreach($keys as $item) {
foreach ($keys as $item) {
if (substr($item, 0, strlen($aggregateType)) === $aggregateType) {
$this->connection->delete($item);
}
Expand Down
4 changes: 3 additions & 1 deletion tests/Container/MemcachedSnapshotStoreFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ public function it_gets_serializer_from_container_when_not_instanceof_serializer

$container->get('my_connection')->willReturn($connection)->shouldBeCalled();
$container->get('config')->willReturn($config)->shouldBeCalled();
$container->get('serializer_servicename')->willReturn(new CallbackSerializer(function() {}, function() {}))->shouldBeCalled();
$container->get('serializer_servicename')->willReturn(new CallbackSerializer(function () {
}, function () {
}))->shouldBeCalled();

$factory = new MemcachedSnapshotStoreFactory();
$snapshotStore = $factory($container->reveal());
Expand Down

0 comments on commit dcd4045

Please sign in to comment.