Skip to content
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
27 changes: 27 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
name: Bug report
about: Create a report to help us improve
labels: bug
---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. When calling '...'
2. At the JSON contains '....'
3. Add I'm using the following middleware '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Stacktrace**
If applicable, add the stack trace to help explain your problem.

**Environment (please complete the following information):**
- PHP: [e.g. 7.4.1]

**Additional context**
Add any other context about the problem here.
17 changes: 17 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
name: Feature request
about: Suggest an idea for this project
labels: feature-request
---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
6 changes: 6 additions & 0 deletions .github/ISSUE_TEMPLATE/other.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
name: Other
about: Your issue doesn't fit the above
---


130 changes: 130 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
name: Build

on:
push:
branches: [ develop, master ]
pull_request:
branches: [ develop, master ]

jobs:
build:
name: PHP ${{ matrix.name }}
strategy:
matrix:
include:
- php: 7.2
allow_fail: false
name: 'PHP 7.2 with latest deps'
- php: 7.2
allow_fail: false
composer_update_flags: '--prefer-lowest --prefer-stable'
name: 'PHP 7.2 with lowest stable deps'
- php: 7.3
allow_fail: false
name: 'PHP 7.3 with latest deps'
- php: 7.3
allow_fail: false
composer_update_flags: '--prefer-lowest --prefer-stable'
name: 'PHP 7.3 with lowest stable deps'
- php: 7.4
allow_fail: false
name: 'PHP 7.4 with latest deps'
- php: 7.4
allow_fail: false
composer_update_flags: '--prefer-lowest --prefer-stable'
name: 'PHP 7.4 with lowest stable deps'
- php: 8.0
allow_fail: false
php_ini: 'xdebug.coverage_enable=On'
name: 'PHP 8.0 with latest deps'
- php: 8.0
allow_fail: false
composer_update_flags: '--prefer-lowest --prefer-stable'
php_ini: 'xdebug.coverage_enable=On'
name: 'PHP 8.0 with lowest stable deps'
- php: 8.1
allow_fail: true
php_ini: 'xdebug.coverage_enable=On'
name: 'PHP 8.1 with latest deps'
- php: 8.1
allow_fail: true
composer_update_flags: '--prefer-lowest --prefer-stable'
php_ini: 'xdebug.coverage_enable=On'
name: 'PHP 8.1 with lowest stable deps'
- php: 8.2
allow_fail: true
php_ini: 'xdebug.coverage_enable=On'
name: 'PHP 8.2 with latest deps'
- php: 8.2
allow_fail: true
composer_update_flags: '--prefer-lowest --prefer-stable'
php_ini: 'xdebug.coverage_enable=On'
name: 'PHP 8.2 with lowest stable deps'
- php: 8.3
allow_fail: true
php_ini: 'xdebug.coverage_enable=On'
name: 'PHP 8.3 with latest deps'
- php: 8.3
allow_fail: true
composer_update_flags: '--prefer-lowest --prefer-stable'
php_ini: 'xdebug.coverage_enable=On'
name: 'PHP 8.3 with lowest stable deps'
- php: 8.4
allow_fail: true
php_ini: 'xdebug.coverage_enable=On'
name: 'PHP 8.4 with latest deps'
- php: 8.4
allow_fail: true
composer_update_flags: '--prefer-lowest --prefer-stable'
php_ini: 'xdebug.coverage_enable=On'
name: 'PHP 8.4 with lowest stable deps'

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Validate composer.json and composer.lock
run: composer validate

- name: Setup PHP ${{ matrix.php }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: xdebug
ini-values: ${{ matrix.php_ini }}

- name: Install dependencies
run: composer install ${{ matrix.composer_flags }}
continue-on-error: ${{ matrix.allow_fail }}

- name: Update dependencies
if: matrix.composer_update_flags
run: composer update ${{ matrix.composer_update_flags }} && composer update phpunit/phpunit guzzlehttp/guzzle --with-dependencies
continue-on-error: ${{ matrix.allow_fail }}

- name: Create log folder
run: mkdir -p build/logs;

- name: Run unit tests
run: composer unit-tests
continue-on-error: ${{ matrix.allow_fail }}

- name: Upload test coverage
run: php vendor/bin/php-coveralls -vvv
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_PARALLEL: true
COVERALLS_FLAG_NAME: ${{ matrix.name }}
continue-on-error: ${{ matrix.allow_fail }}

finish:
needs: build
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
run: |
curl --header "Content-Type: application/json" \
--request POST \
--data '{"repo_token":"${{ secrets.GITHUB_TOKEN }}","repo_name":"JsonMapper/LaravelPackage", "payload": {"build_num": "${{ github.sha }}", "status": "done"}}' \
https://coveralls.io/webhook
8 changes: 0 additions & 8 deletions .mergify.yml

This file was deleted.

54 changes: 0 additions & 54 deletions .travis.yml

This file was deleted.

2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
## Changed
- Migrate from Travis CI to GitHub CI [PR#8](https://github.com/JsonMapper/EloquentMiddleware/pull/8)

## [2.0.0]
## Changed
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@
"json-mapper/laravel-package": "^2.0",
"php": "^7.2 || ^8.0",
"doctrine/dbal": "^2.3",
"json-mapper/json-mapper": "^2.0"
"json-mapper/json-mapper": "^2.13"
},
"require-dev": {
"squizlabs/php_codesniffer": "^3.5",
"phpstan/phpstan": "^0.12.19",
"php-coveralls/php-coveralls": "^2.2",
"orchestra/testbench": "^5.3",
"orchestra/testbench": "^5.20",
"phpunit/phpunit": "^8.5 || ^9.0"
},
"scripts": {
Expand Down
3 changes: 2 additions & 1 deletion src/EloquentMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use JsonMapper\Enums\Visibility;
use JsonMapper\JsonMapperInterface;
use JsonMapper\Middleware\AbstractMiddleware;
use JsonMapper\ValueObjects\ArrayInformation;
use JsonMapper\ValueObjects\PropertyMap;
use JsonMapper\ValueObjects\PropertyType;
use JsonMapper\Wrapper\ObjectWrapper;
Expand Down Expand Up @@ -132,7 +133,7 @@ protected function discoverPropertiesFromTable(Model $model, PropertyMap $proper

$property = PropertyBuilder::new()
->setName($name)
->addType($type, false)
->addType($type, ArrayInformation::notAnArray())
->setIsNullable(!$column->getNotnull())
->setVisibility(Visibility::PUBLIC())
->build();
Expand Down
5 changes: 3 additions & 2 deletions tests/Unit/EloquentMiddlewareTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace JsonMapper\EloquentMiddleware\Tests\Integration;
namespace JsonMapper\EloquentMiddleware\Tests\Unit;

use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Schema\AbstractSchemaManager;
Expand All @@ -15,6 +15,7 @@
use JsonMapper\Enums\Visibility;
use JsonMapper\JsonMapperInterface;
use JsonMapper\Tests\Helpers\AssertThatPropertyTrait;
use JsonMapper\ValueObjects\ArrayInformation;
use JsonMapper\ValueObjects\PropertyMap;
use JsonMapper\Wrapper\ObjectWrapper;
use Orchestra\Testbench\TestCase;
Expand Down Expand Up @@ -52,7 +53,7 @@ public function testColumnsFromTheDatabaseAreReturned(): void
self::assertTrue($propertyMap->hasProperty('id'));
$this->assertThatProperty($propertyMap->getProperty('id'))
->hasName('id')
->onlyHasType('integer', false)
->onlyHasType('integer', ArrayInformation::notAnArray())
->hasVisibility(Visibility::PUBLIC())
->isNotNullable();
}
Expand Down
Loading