Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
088fdee
Update dependencies to newest frameworks.
etrepat Mar 21, 2019
e24d828
Add vscode workspace settings to .gitignore.
etrepat Mar 21, 2019
c2d6cf4
Fix compatibility issues with newer frameworks.
etrepat Mar 21, 2019
79d9cad
Fix tests.
etrepat Mar 21, 2019
1521e70
PSR-4 changes.
etrepat Mar 21, 2019
bc36c6a
Add L5.5+ package auto-discovery.
etrepat Mar 21, 2019
37e0ea5
Update phpunit library version.
etrepat Mar 22, 2019
7a78dc6
Update Travis CI config.
etrepat Mar 22, 2019
1e56290
Add .editorconfig file.
etrepat Mar 22, 2019
f248ae9
Fix test for Laravel 5.5
etrepat Mar 26, 2019
db53aff
Revamp implementation to a trait-based one.
etrepat May 8, 2019
8931049
Use class based array helpers.
etrepat May 8, 2019
3ed3da3
Change test models to use trait interface.
etrepat May 8, 2019
bc7e841
Qualify column names on delete descendants query.
etrepat May 8, 2019
d33e8d6
Improve target node resolving logic on move operation.
etrepat May 8, 2019
f61672a
Update dependencies.
etrepat May 8, 2019
ad9bb89
Update travis config.
etrepat May 8, 2019
749d635
More travis changes.
etrepat May 8, 2019
bf55841
Migrate to phpunit 8.
etrepat May 8, 2019
4993ee6
Change indent size for yaml files in editorconfig.
etrepat May 8, 2019
fadc32b
Cast nested set attributes to int.
etrepat May 9, 2019
7f5d2cf
Remove xdebug from travis.
etrepat May 10, 2019
e09c0f6
Test config changes.
etrepat May 16, 2019
c60fd80
Update depedencies.
etrepat May 17, 2019
3a65927
Change travis config.
etrepat May 17, 2019
cad1e49
Change test bootstrap init process.
etrepat May 21, 2019
85ad40f
Modify column scope implementation.
etrepat May 21, 2019
d15e880
Simplify max right finding query.
etrepat May 21, 2019
8770e4f
Simplify 'destroyDescendants' query.
etrepat May 21, 2019
31e09f1
Simplify query.
etrepat May 21, 2019
e1ec622
Remove class methods dependencies on tests.
etrepat Jun 6, 2019
dbdf2d5
More 'qualify', simplify and improve logic a little.
etrepat Jun 6, 2019
206d58c
Control test db connection with ENV.
etrepat Jun 6, 2019
013dcd3
Fix bad getenv call.
etrepat Sep 16, 2019
1fb4b6a
Add Laravel v6.x support.
etrepat Sep 16, 2019
e660750
Update composer.json and travis configs.
etrepat Nov 4, 2019
02fd160
Change travis to bionic image.
etrepat Nov 4, 2019
64a6ac9
Extract testing UUID related functionality.
etrepat Nov 4, 2019
f209f67
Add fullpath option to migration maker command.
etrepat Nov 8, 2019
e4ac7e7
Add laravel 7.x support. Needs testing.
etrepat Apr 9, 2020
b56eb6f
Add php 7.4 to travis test matrix.
etrepat Apr 9, 2020
5a2fc0d
Remove phpcs cache file and add it to .gitignore file.
etrepat Sep 1, 2020
75b02fd
Move code around.
etrepat Sep 1, 2020
0e9d488
Changes to composer.json (dev packages & php ver.)
etrepat Sep 1, 2020
07eb176
Minor model & migration generator fixes.
etrepat Sep 1, 2020
fa6208a
Use big integer fields by default.
etrepat Sep 1, 2020
72229d1
Add latest laravel support.
etrepat Sep 1, 2020
582dae0
Add laravel's develop branch to travis.
etrepat Sep 1, 2020
485d66e
Use ^8.0 branch alias for latest laravel on travis.
etrepat Sep 2, 2020
fd3ff4d
Allow latest phpunit version.
etrepat Sep 2, 2020
efb6612
Extract depth-related methods into their own trait.
etrepat Sep 2, 2020
4787581
Recover 'immediateDescendants' alias.
etrepat Sep 2, 2020
1da4480
Add movement related utilities into corresponding trait.
etrepat Sep 2, 2020
7c317be
Move method to where it *should* be.
etrepat Sep 2, 2020
24c331d
Cleanup.
etrepat Sep 2, 2020
4702589
Update dependencies.
etrepat Aug 10, 2022
c0907c5
Replace travis w/github actions.
etrepat Aug 10, 2022
625816e
Preliminar support for laravel 10.x
etrepat Feb 21, 2023
bfb75d6
Add preliminar support for laravel 11.x
etrepat Jun 11, 2024
40a7984
Update gh actions.
etrepat Jun 11, 2024
f44497e
Add preliminar support for laravel 12.x
ELtd Apr 24, 2025
c5e0fe5
Update tests matrix for Laravel 12
ELtd Apr 24, 2025
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
15 changes: 15 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false

[*.yml]
indent_size = 2
75 changes: 75 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Tests

on:
push:
pull_request:
schedule:
- cron: '0 0 * * *'

jobs:
tests:
runs-on: ubuntu-20.04

strategy:
fail-fast: true
matrix:
php: [7.3, 7.4, 8.0, 8.1, 8.2, 8.3]
laravel: [8.0, 9.0, 10.0, 11.0, 12.0]
exclude:
- php: 7.3
laravel: 9.0
- php: 7.3
laravel: 10.0
- php: 7.3
laravel: 11.0
- php: 7.3
laravel: 12.0
- php: 7.4
laravel: 9.0
- php: 7.4
laravel: 10.0
- php: 7.4
laravel: 11.0
- php: 7.4
laravel: 12.0
- php: 8.0
laravel: 10.0
- php: 8.0
laravel: 11.0
- php: 8.0
laravel: 12.0
- php: 8.1
laravel: 11.0
- php: 8.1
laravel: 12.0
- php: 8.2
laravel: 8.0

name: PHP ${{ matrix.php }} - Laravel ${{ matrix.laravel }}

steps:
- name: Checkout code
uses: actions/checkout@v4

# Docs: https://github.com/shivammathur/setup-php
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: curl, libxml, mbstring, sqlite3
ini-values: error_reporting=E_ALL
tools: composer:v2
coverage: none

- name: Setup problem matchers for PHP/PHPUnit
run: |
echo "::add-matcher::${{ runner.tool_cache }}/php.json"
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"

- name: Install dependencies
run: |
composer require "illuminate/contracts=^${{ matrix.laravel }}" --no-update
composer update --prefer-dist --no-interaction --no-progress

- name: Execute test suite
run: vendor/bin/phpunit
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
/vendor
composer.lock
.vscode
.phpunit.result.cache
.php_cs.cache
.phpunit.cache
14 changes: 0 additions & 14 deletions .travis.yml

This file was deleted.

79 changes: 51 additions & 28 deletions bootstrap.php
Original file line number Diff line number Diff line change
@@ -1,38 +1,61 @@
<?php

/**
* Register composer auto loader
*/
/*
|--------------------------------------------------------------------------
| Register The Auto Loader
|--------------------------------------------------------------------------
|
| Composer provides a convenient, automatically generated class loader
| for our library. We just need to utilize it!
|
*/

require __DIR__.'/vendor/autoload.php';

/**
* Initialize Capsule
*/
$capsule = new Illuminate\Database\Capsule\Manager;
/*
|--------------------------------------------------------------------------
| Initialize the Eloquent database manager
|--------------------------------------------------------------------------
|
| Eloquent can run as a stand-alone library (outside of Laravel applications)
| with all its functionality intact. We just need to bootstrap it correctly.
|
*/

$capsule->addConnection(require(__DIR__.'/tests/config/database.php'));
use Illuminate\Container\Container;
use Illuminate\Database\Capsule\Manager as Capsule;
use Illuminate\Events\Dispatcher;

$capsule->setEventDispatcher(new Illuminate\Events\Dispatcher(new Illuminate\Container\Container));
$capsule = new Capsule;

$capsule->bootEloquent();
$capsule->addConnection(require(__DIR__.'/tests/config/database.php'));

$capsule->setEventDispatcher(new Dispatcher(new Container));

$capsule->setAsGlobal();

/**
* Autoload required libraries
*/
$__autoload_paths = array('models', 'migrators', 'seeders');

foreach($__autoload_paths as $path) {
foreach(glob(__DIR__ . "/tests/$path/*.php") as $dep) {
require_once $dep;
}
}

/**
* Require test helpers
*/
require __DIR__ . '/tests/suite/support.php';
require __DIR__ . '/tests/suite/BaumTestCase.php';
require __DIR__ . '/tests/suite/CategoryTestCase.php';
require __DIR__ . '/tests/suite/ClusterTestCase.php';
$capsule->bootEloquent();

/*
|--------------------------------------------------------------------------
| Initialize the Collection extensions
|--------------------------------------------------------------------------
|
| This would normally be under a service provider on a laravel application but
| for testing we just initialize the mixin here.
|
*/

\Illuminate\Database\Eloquent\Collection::mixin(new \Baum\Mixins\Collection);

/*
|--------------------------------------------------------------------------
| Initialize the schema blueprint extensions
|--------------------------------------------------------------------------
|
| This would normally be under a service provider on a laravel application but
| for testing we just initialize the mixin here.
|
*/

\Illuminate\Database\Schema\Blueprint::mixin(new \Baum\Mixins\Blueprint);
32 changes: 0 additions & 32 deletions boris

This file was deleted.

50 changes: 36 additions & 14 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,53 @@
"name": "baum/baum",
"type": "library",
"description": "Baum is an implementation of the Nested Set pattern for Eloquent models.",
"keywords": ["nested set", "laravel", "laravel 4", "laravel 5", "eloquent", "database"],
"keywords": ["nested set", "laravel", "eloquent", "database", "tree", "hierarchy"],
"license": "MIT",
"authors": [
{
"name": "Estanislau Trepat",
"email": "estanis@etrepat.com",
"homepage": "http://etrepat.com"
"homepage": "https://etrepat.com"
}
],
"require": {
"php": ">=5.4.0",
"illuminate/console": "5.*",
"illuminate/database": "5.*",
"illuminate/events": "5.*",
"illuminate/filesystem": "5.*",
"illuminate/support": "5.*"
"php": "^7.3|^8.0|^8.1|^8.2",
"illuminate/contracts": "^8.0|^9.0|^10.0|^11.0|^12.0",
"illuminate/database": "^8.0|^9.0|^10.0|^11.0|^12.0",
"illuminate/events": "^8.0|^9.0|^10.0|^11.0|^12.0",
"illuminate/support": "^8.0|^9.0|^10.0|^11.0|^12.0"
},
"require-dev": {
"phpunit/phpunit": "~4.0",
"mockery/mockery": "~0.9",
"d11wtq/boris": "~1.0.10"
"mockery/mockery": "^1.4",
"phpunit/phpunit": "^8.5.19|^9.5.8|^11.0.1|^11.5.3",
"psy/psysh": "@stable",
"squizlabs/php_codesniffer": "*",
"illuminate/console": "^8.0|^9.0|^10.0|^11.0|^12.0",
"illuminate/filesystem": "^8.0|^9.0|^10.0|^11.0|^12.0"
},
"autoload": {
"psr-0": {
"Baum": "src/"
"psr-4": {
"Baum\\": "src/"
}
}
},
"autoload-dev": {
"files": [
"tests/suite/Support/helpers.php"
],
"psr-4": {
"Baum\\Tests\\": "tests/suite/"
}
},
"extra": {
"laravel": {
"providers": [
"Baum\\BaumServiceProvider"
]
}
},
"config": {
"sort-packages": true
},
"minimum-stability": "dev",
"prefer-stable": true
}
21 changes: 21 additions & 0 deletions console
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env php
<?php
/**
* Baum, an implementation of the [Nested Set](http://en.wikipedia.org/wiki/Nested_set_model)
* pattern for Laravel's Eloquent ORM.
*
* @package Baum
* @author Estanislau Trepat <estanis@etrepat.com>
*/

require __DIR__ . '/bootstrap.php';

class Test extends Illuminate\Database\Eloquent\Model {
use Baum\NestedSet\Node;

protected $tableName = 'forest';
}

with(new \Baum\Tests\Support\Migrators\CategoryMigrator)->up();

exit($status = Baum\Playground\Console::start());
11 changes: 11 additions & 0 deletions phpcs.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0"?>
<ruleset name="PHP_CodeSniffer">
<description>The coding standard for Baum.</description>

<!-- Include the whole PSR2 standard -->
<rule ref="PSR2" />

<!-- Include some other sniffs -->
<rule ref="Generic.Arrays.ArrayIndent" />
<rule ref="Generic.Arrays.DisallowLongArraySyntax"/>
</ruleset>
28 changes: 14 additions & 14 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
bootstrap="bootstrap.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false">
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.2/phpunit.xsd"
backupGlobals="false"
beStrictAboutTestsThatDoNotTestAnything="false"
bootstrap="./bootstrap.php"
colors="true"
failOnRisky="true"
failOnWarning="true"
processIsolation="false"
stopOnError="false"
stopOnFailure="false"
cacheDirectory=".phpunit.cache"
backupStaticProperties="false">
<testsuites>
<testsuite name="Baum Test Suite">
<file>tests/suite/QueryBuilderExtensionTest.php</file>
<file>tests/suite/NodeModelExtensionsTest.php</file>
<directory>tests/suite/Category</directory>
<directory>tests/suite/Cluster</directory>
<directory suffix="Test.php">./tests/suite</directory>
</testsuite>
</testsuites>
</phpunit>
Loading