Skip to content

Commit

Permalink
Merge pull request #2 from gurgentil/feature/ci
Browse files Browse the repository at this point in the history
CI integration
  • Loading branch information
gurgentil authored May 1, 2020
2 parents 41656b2 + b0807c5 commit 50779d1
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 24 deletions.
19 changes: 19 additions & 0 deletions .scrutinizer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
filter:
excluded_paths: [tests/*]

checks:
php:
remove_extra_empty_lines: true
remove_php_closing_tag: true
remove_trailing_whitespace: true
fix_use_statements:
remove_unused: true
preserve_multiple: false
preserve_blanklines: true
order_alphabetically: true
fix_php_opening_tag: true
fix_linefeed: true
fix_line_ending: true
fix_identation_4spaces: true
fix_doc_comments: true

20 changes: 20 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
language: php

php:
- 7.2
- 7.3

env:
matrix:
- COMPOSER_FLAGS="--prefer-lowest"
- COMPOSER_FLAGS=""

before_script:
- travis_retry composer self-update
- travis_retry composer update ${COMPOSER_FLAGS} --no-interaction --prefer-source

script:
- vendor/bin/phpunit --coverage-text --coverage-clover=coverage.clover

after_script:
- php vendor/bin/ocular code-coverage:upload --format=php-clover coverage.clover
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
}
],
"require": {
"php": "^7.1",
"php": "^7.2",
"illuminate/support": "^6.0"
},
"require-dev": {
Expand Down
2 changes: 1 addition & 1 deletion src/Console/Commands/FlushSequenceValues.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public function handle()

$columnName = ($class)::getSequenceColumnName();

$modelsToUpdate = $models->whereNotNull($columnName);
$modelsToUpdate = $models->where($columnName, '!=', null);

$modelsToUpdate->each(function ($model) use ($columnName) {
$model->withoutSequencing()->update([
Expand Down
2 changes: 1 addition & 1 deletion src/Console/Commands/PopulateSequenceValues.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public function handle()

$columnName = ($class)::getSequenceColumnName();

$modelsToUpdate = $models->whereNull($columnName);
$modelsToUpdate = $models->where($columnName, null);

$modelsToUpdate->each(function ($model) use ($columnName) {
$model->withoutSequencing()->update([
Expand Down
2 changes: 1 addition & 1 deletion src/Traits/Sequenceable.php
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ protected function getSequence(): Collection

return static::where($this->getSequenceQueryConstraints())
->select($this->getSequenceQuerySelectColumns())
->whereNotNull($columnName)
->where($columnName, '!=', null)
->orderBy($columnName)
->get();
}
Expand Down
40 changes: 20 additions & 20 deletions tests/Unit/CreateObjectInTheMiddleOfTheSequenceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ class CreateObjectInTheMiddleOfTheSequenceTest extends TestCase
/** @test */
public function it_creates_an_object_with_sequence_value_equal_to_1_and_move_the_group_around()
{
$group = Factory::of('group')->create();
$group = Factory::of('Group')->create();

$firstItem = Factory::of('item')->create(['group_id' => $group->id]);
$secondItem = Factory::of('item')->create(['group_id' => $group->id]);
$thirdItem = Factory::of('item')->create(['group_id' => $group->id]);
$firstItem = Factory::of('Item')->create(['group_id' => $group->id]);
$secondItem = Factory::of('Item')->create(['group_id' => $group->id]);
$thirdItem = Factory::of('Item')->create(['group_id' => $group->id]);

$newItem = Factory::of('item')->create([
$newItem = Factory::of('Item')->create([
'position' => 1,
'group_id' => $group->id,
]);
Expand All @@ -30,13 +30,13 @@ public function it_creates_an_object_with_sequence_value_equal_to_1_and_move_the
/** @test */
public function it_creates_an_object_with_sequence_value_equal_to_2_and_move_the_group_around()
{
$group = Factory::of('group')->create();
$group = Factory::of('Group')->create();

$firstItem = Factory::of('item')->create(['group_id' => $group->id]);
$secondItem = Factory::of('item')->create(['group_id' => $group->id]);
$thirdItem = Factory::of('item')->create(['group_id' => $group->id]);
$firstItem = Factory::of('Item')->create(['group_id' => $group->id]);
$secondItem = Factory::of('Item')->create(['group_id' => $group->id]);
$thirdItem = Factory::of('Item')->create(['group_id' => $group->id]);

$newItem = Factory::of('item')->create([
$newItem = Factory::of('Item')->create([
'position' => 2,
'group_id' => $group->id,
]);
Expand All @@ -50,13 +50,13 @@ public function it_creates_an_object_with_sequence_value_equal_to_2_and_move_the
/** @test */
public function it_creates_an_object_with_sequence_value_equal_to_3_and_move_the_group_around()
{
$group = Factory::of('group')->create();
$group = Factory::of('Group')->create();

$firstItem = Factory::of('item')->create(['group_id' => $group->id]);
$secondItem = Factory::of('item')->create(['group_id' => $group->id]);
$thirdItem = Factory::of('item')->create(['group_id' => $group->id]);
$firstItem = Factory::of('Item')->create(['group_id' => $group->id]);
$secondItem = Factory::of('Item')->create(['group_id' => $group->id]);
$thirdItem = Factory::of('Item')->create(['group_id' => $group->id]);

$newItem = Factory::of('item')->create([
$newItem = Factory::of('Item')->create([
'position' => 3,
'group_id' => $group->id,
]);
Expand All @@ -70,13 +70,13 @@ public function it_creates_an_object_with_sequence_value_equal_to_3_and_move_the
/** @test */
public function it_creates_an_object_with_sequence_value_equal_to_4_and_move_the_group_around()
{
$group = Factory::of('group')->create();
$group = Factory::of('Group')->create();

$firstItem = Factory::of('item')->create(['group_id' => $group->id]);
$secondItem = Factory::of('item')->create(['group_id' => $group->id]);
$thirdItem = Factory::of('item')->create(['group_id' => $group->id]);
$firstItem = Factory::of('Item')->create(['group_id' => $group->id]);
$secondItem = Factory::of('Item')->create(['group_id' => $group->id]);
$thirdItem = Factory::of('Item')->create(['group_id' => $group->id]);

$newItem = Factory::of('item')->create([
$newItem = Factory::of('Item')->create([
'position' => 4,
'group_id' => $group->id,
]);
Expand Down

0 comments on commit 50779d1

Please sign in to comment.