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

Implementation of database drivers (recreated) #10

Open
wants to merge 53 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
4299772
require-dev phpunit
writ3it Sep 6, 2019
efe64b8
require-dev php version
writ3it Sep 6, 2019
b661b97
append composer script, autoloader, mysqli utilities and env test
writ3it Sep 6, 2019
9f5f649
separate env data
writ3it Sep 6, 2019
c5bc6e7
base of testing
writ3it Sep 6, 2019
fa790f8
Merge pull request #1 from writ3it/testing
writ3it Sep 6, 2019
337ece8
remove old conception to mocking mysqli
writ3it Sep 6, 2019
96d196a
some structure of drivers,
writ3it Sep 7, 2019
5774ef0
code rearrange, dealing with errors
writ3it Sep 7, 2019
09e469d
locking table
writ3it Sep 7, 2019
08ae929
unlocking table
writ3it Sep 7, 2019
b9812b0
updating
writ3it Sep 7, 2019
580cbf3
updates
writ3it Sep 7, 2019
a2bbecb
inserts
writ3it Sep 7, 2019
a1ea48f
last insert id
writ3it Sep 7, 2019
0d7c2e5
delete
writ3it Sep 7, 2019
0adbc64
select
writ3it Sep 7, 2019
bb31a6d
result
writ3it Sep 7, 2019
0fddca5
PDO, extract sql
writ3it Sep 7, 2019
9c8c784
extract sql
writ3it Sep 7, 2019
e3a61d1
close connection
writ3it Sep 7, 2019
ebec12f
In memory driver for tests
writ3it Sep 7, 2019
8d790a6
Query
writ3it Sep 7, 2019
18ee923
helper methods for tests
writ3it Sep 7, 2019
f11cb3f
helper methods for tests
writ3it Sep 7, 2019
634feec
base of tests
writ3it Sep 7, 2019
c1e2569
sqlite cannot lock table
writ3it Sep 7, 2019
7b30cd2
little bug, append item
writ3it Sep 7, 2019
990386f
safe executing
writ3it Sep 7, 2019
62fd2c8
values without qoutes
writ3it Sep 7, 2019
d933c80
auto_increment emulation
writ3it Sep 7, 2019
adad36c
infinity loop bug on php7
writ3it Sep 7, 2019
ea439b0
braces
writ3it Sep 7, 2019
1872907
accidental recursion removed
writ3it Sep 7, 2019
b971afd
error in deletion corrected
writ3it Sep 7, 2019
e2efb17
default operator produced unexpected substr, that is better
writ3it Sep 7, 2019
e2e252e
tests
writ3it Sep 7, 2019
9ae63cc
namespaces changed
writ3it Sep 7, 2019
f2a539c
tests namespaces changed
writ3it Sep 7, 2019
693f1eb
update description
writ3it Sep 7, 2019
64f3c11
update example
writ3it Sep 7, 2019
1b141f4
removed unnecessary function
writ3it Sep 7, 2019
a689cc6
testing instruction
writ3it Sep 7, 2019
6bd7205
require for tests
writ3it Sep 7, 2019
7a89da6
code review, improvements
writ3it Sep 7, 2019
ce26a01
Merge pull request #2 from writ3it/driver-extracting
writ3it Sep 7, 2019
85f362f
column escaping
writ3it Sep 7, 2019
7ae9bd0
Merge pull request #3 from writ3it/escaping
writ3it Sep 7, 2019
619f90c
missing constructor for compatibility
writ3it Sep 7, 2019
ecdf16f
Merge pull request #4 from writ3it/escaping
writ3it Sep 7, 2019
a028350
fix tests
writ3it Sep 7, 2019
36b7a50
Merge remote-tracking branch 'origin/master'
writ3it Sep 7, 2019
e6a9baf
updated example
writ3it Sep 7, 2019
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
29 changes: 27 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Zebra\_Mptt uses [table locks](http://dev.mysql.com/doc/refman/5.0/en/lock-table

## Requirements

PHP 5.0.0+, MySQL 4.1.22+
PHP 5.0.0+, MySQL 4.1.22+, mysqli extension or PDO extension

## Installation

Expand All @@ -61,6 +61,12 @@ Or you can install it manually by downloading the latest version, unpacking it,
require_once 'path/to/Zebra_Mptt.php';
```

or

```php
use Zebra\Mptt\Mptt;
```

## Install MySQL table

Notice a directory called *install* containing a file named *mptt.sql*. This file contains the SQL code that will create the table used by the class to store its data. Import or execute the SQL code using your preferred MySQL manager (like phpMyAdmin or the fantastic Adminer) into a database of your choice.
Expand All @@ -72,7 +78,7 @@ Notice a directory called *install* containing a file named *mptt.sql*. This fil
require 'path/to/Zebra_Mptt.php';

// instantiate a new object
$mptt = new Zebra_Mptt();
$mptt = new Zebra_Mptt($mysqlLink);

// populate the table

Expand Down Expand Up @@ -106,3 +112,22 @@ $mptt->get_tree();
```

:books: Check out the [awesome documentation](https://stefangabos.github.io/Zebra_Mptt/Zebra_Mptt/Zebra_Mptt.html)!


# Testing

Tests requires >= php 7.2.

Step 1. Clone this repository
```bash
git clone [email protected]:stefangabos/Zebra_Mptt.git
cd Zebra_Mptt
```
Step 2. Install dependencies
```bash
composer install
```
Step 3. Run tests (phpunit, see composer.json scripts)
```bash
composer test
```
Loading