Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restructure docs #2

Merged
merged 3 commits into from
Oct 15, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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