Skip to content

Commit 9679226

Browse files
author
Peter Klooster
committed
Added tests, fixed some bugs that showed due to tests
1 parent b911037 commit 9679226

File tree

15 files changed

+1144
-619
lines changed

15 files changed

+1144
-619
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.idea
2+
/vendor
3+
/coverage
4+
composer.lock

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ By default the query builder will fetch the latest version (e. g. `User::find(1)
9090

9191
* `allVersions()` returns all versions of the queried items<br>Example: `User::allVersions()->get()` will return all versions of all users
9292

93+
* `moment(Carbon)` returns a specific version, closest but lower than the input date<br>Example: `User::moment(Carbon::now()->subWeek()->find(1)` will return the version at that point in time.
94+
9395
#### Create, update and delete records
9496

9597
All these operations can be performed normally. The package will automatically generate a version 1 on create, the next version on update and will remove all versions on delete.

composer.json

Lines changed: 47 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,47 @@
1-
{
2-
"name": "proai/eloquent-versioning",
3-
"description": "An extension for the Eloquent ORM to support versioning.",
4-
"keywords": ["laravel","orm","eloquent","revision","version","versioned","versioning","audit"],
5-
"homepage": "http://github.com/ProAI/eloquent-versioning",
6-
"license": "MIT",
7-
"authors": [
8-
{
9-
"name": "Markus J. Wetzel",
10-
"email": "markuswetzel@gmx.net"
11-
}
12-
],
13-
"require": {
14-
"php": ">=5.4.0",
15-
"illuminate/database": "5.*"
16-
},
17-
"autoload": {
18-
"psr-4": {
19-
"ProAI\\Versioning\\": "src/"
20-
}
21-
},
22-
"extra": {
23-
"branch-alias": {
24-
"dev-master": "1.0-dev"
25-
}
26-
}
27-
}
1+
{
2+
"name": "proai/eloquent-versioning",
3+
"description": "An extension for the Eloquent ORM to support versioning.",
4+
"keywords": [
5+
"laravel",
6+
"orm",
7+
"eloquent",
8+
"revision",
9+
"version",
10+
"versioned",
11+
"versioning",
12+
"audit"
13+
],
14+
"homepage": "http://github.com/ProAI/eloquent-versioning",
15+
"license": "MIT",
16+
"authors": [
17+
{
18+
"name": "Markus J. Wetzel",
19+
"email": "markuswetzel@gmx.net"
20+
}
21+
],
22+
"require": {
23+
"php": ">=7.1",
24+
"illuminate/database": "5.*"
25+
},
26+
"require-dev": {
27+
"phpunit/phpunit": "^7.0",
28+
"mockery/mockery": "^1.0",
29+
"orchestra/testbench": "^3.6",
30+
"orchestra/database": "^3.6"
31+
},
32+
"autoload": {
33+
"psr-4": {
34+
"ProAI\\Versioning\\": "src/"
35+
}
36+
},
37+
"autoload-dev": {
38+
"psr-4": {
39+
"ProAI\\Versioning\\Tests\\": "tests/"
40+
}
41+
},
42+
"extra": {
43+
"branch-alias": {
44+
"dev-master": "1.0-dev"
45+
}
46+
}
47+
}

phpunit.xml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit backupGlobals="false"
3+
backupStaticAttributes="false"
4+
bootstrap="vendor/autoload.php"
5+
colors="true"
6+
convertErrorsToExceptions="true"
7+
convertNoticesToExceptions="true"
8+
convertWarningsToExceptions="true"
9+
processIsolation="false"
10+
stopOnError="false"
11+
stopOnFailure="false"
12+
syntaxCheck="true"
13+
verbose="true"
14+
>
15+
<testsuites>
16+
<testsuite name="Versioning Test Suite">
17+
<directory suffix="Test.php">./tests</directory>
18+
</testsuite>
19+
</testsuites>
20+
<filter>
21+
<whitelist processUncoveredFilesFromWhitelist="true">
22+
<directory suffix=".php">./src</directory>
23+
</whitelist>
24+
</filter>
25+
</phpunit>

src/Builder.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
<?php
2-
3-
namespace ProAI\Versioning;
4-
5-
use Illuminate\Database\Eloquent\Builder as BaseBuilder;
6-
7-
class Builder extends BaseBuilder
8-
{
9-
use BuilderTrait;
1+
<?php
2+
3+
namespace ProAI\Versioning;
4+
5+
use Illuminate\Database\Eloquent\Builder as BaseBuilder;
6+
7+
class Builder extends BaseBuilder
8+
{
9+
use BuilderTrait;
1010
}

0 commit comments

Comments
 (0)