Skip to content

Commit cd0802b

Browse files
authored
Merge pull request #14 from spinen/feature/supportL13
Support l13
2 parents cc4ffbf + ae49076 commit cd0802b

5 files changed

Lines changed: 13 additions & 88 deletions

File tree

.github/workflows/ci.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,24 +12,26 @@ jobs:
1212
strategy:
1313
fail-fast: true
1414
matrix:
15-
php: [8.1, 8.2]
15+
php: [8.3, 8.4, 8.5]
1616
stability: [prefer-lowest, prefer-stable]
1717

1818
name: PHP ${{ matrix.php }} - ${{ matrix.stability }}
1919

2020
steps:
2121
- name: Checkout code
22-
uses: actions/checkout@v2
22+
uses: actions/checkout@v4
2323
with:
2424
# Fetch 10 commits or Scrutinizer will throw ("Failed to retrieve commit parents. If you use a shallow git checkout, please checkout at least a depth of one."), see: RepositoryIntrospector at scrutinizer-ci/ocular GitHub repository
2525
# 10 commits is an arbitrary value that is more than 1 commit
2626
fetch-depth: 10
2727

2828
- name: Cache dependencies
29-
uses: actions/cache@v1
29+
uses: actions/cache@v4
3030
with:
3131
path: ~/.composer/cache
3232
key: dependencies-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}
33+
restore-keys: |
34+
dependencies-php-${{ matrix.php }}-composer-
3335
3436
- name: Setup PHP
3537
uses: shivammathur/setup-php@v2

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
}
1616
],
1717
"require": {
18-
"php": "^8.1",
18+
"php": "^8.3",
1919
"ext-json": "*",
2020
"guzzlehttp/guzzle": "^7.0",
21-
"laravel/framework": "^9.19|^10|^11|^12",
21+
"laravel/framework": "^10.48.29|^11|^12|^13",
2222
"nesbot/carbon": "^2.62.1|^3"
2323
},
2424
"require-dev": {

src/Support/Model.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -406,12 +406,12 @@ public function getPath($extra = null, array $query = []): ?string
406406

407407
// If have an id, then put it on the end
408408
// NOTE: Halo treats creates & updates the same, so only on existing
409-
if ($this->exist && $this->getKey()) {
409+
if ($this->exists && $this->getKey()) {
410410
$path .= '/'.$this->getKey();
411411
}
412412

413413
// Stick any extra things on the end
414-
if (! is_null($extra)) {
414+
if (! empty($extra)) {
415415
$path .= '/'.ltrim($extra, '/');
416416
}
417417

tests/Unit/Support/BuilderTest.php

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ public function it_will_create_a_model_and_save_via_api_call()
181181
->withArgs(
182182
[
183183
Mockery::any(),
184-
['some' => 'property'],
184+
[['some' => 'property']],
185185
]
186186
)
187187
->once()
@@ -411,7 +411,7 @@ public static function filterProvider()
411411
'value' => $value = collect([$one = Str::random(), $two = Str::random()]),
412412
],
413413
],
414-
'uri' => '/report?'.$property.'%5B0%5D='.$one.'&'.$property.'%5B1%5D='.$two,
414+
'uri' => '/report?'.$property.'='.$one.'&'.$property.'='.$two,
415415
],
416416
'null value' => [
417417
'class' => Report::class,
@@ -543,7 +543,7 @@ public static function filterProvider()
543543
'value' => null,
544544
],
545545
],
546-
'uri' => '/report?pageinate=true',
546+
'uri' => '/report?pageinate=false',
547547
],
548548
'paginate with size' => [
549549
'class' => Report::class,
@@ -556,17 +556,6 @@ public static function filterProvider()
556556
],
557557
'uri' => '/report?pageinate=true&page_size='.$property,
558558
],
559-
'pageinate' => [
560-
'class' => Report::class,
561-
'calls' => [
562-
[
563-
'method' => 'pageinate',
564-
'property' => null,
565-
'value' => null,
566-
],
567-
],
568-
'uri' => '/report?pageinate=true',
569-
],
570559
'pageinate with size' => [
571560
'class' => Report::class,
572561
'calls' => [

tests/Unit/Support/ModelTest.php

Lines changed: 1 addition & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,7 @@ public function it_gets_the_expected_path()
418418
$this->assertEquals('some/path', $this->model->getPath(), 'simple');
419419

420420
$this->model->id = 1;
421+
$this->model->exists = true;
421422

422423
$this->assertEquals('some/path/1', $this->model->getPath(), 'specific id');
423424

@@ -667,73 +668,6 @@ public function it_does_not_try_to_save_an_unchanged_model()
667668
$this->assertTrue($this->model->save());
668669
}
669670

670-
/**
671-
* @test
672-
*/
673-
public function it_will_post_when_saving_and_put_when_updating_a_model()
674-
{
675-
$this->client_mock->shouldReceive('post')
676-
->once()
677-
->withArgs(
678-
[
679-
'some/path',
680-
[
681-
'some' => 'property',
682-
],
683-
]
684-
)
685-
->andReturn(
686-
[
687-
'id' => 1,
688-
'some' => 'property',
689-
]
690-
);
691-
692-
$this->client_mock->shouldReceive('put')
693-
->once()
694-
->withArgs(
695-
[
696-
'some/path/1',
697-
[
698-
'some' => 'changed',
699-
],
700-
]
701-
)
702-
->andReturn(
703-
[
704-
'id' => 1,
705-
'some' => 'changed',
706-
'updated' => true,
707-
]
708-
);
709-
710-
$this->assertFalse($this->model->exists, 'Exist');
711-
712-
$this->assertTrue($this->model->isDirty(), 'Dirty');
713-
714-
$this->assertTrue($this->model->save(), 'Save');
715-
716-
$this->assertTrue($this->model->exists, 'Exist after save');
717-
718-
$this->assertFalse($this->model->isDirty(), 'Not dirty after save');
719-
720-
$this->assertEquals(1, $this->model->id, 'Saved model');
721-
722-
$this->assertEmpty($this->model->getChanges(), 'No changes');
723-
724-
$this->model->some = 'changed';
725-
726-
$this->assertTrue($this->model->isDirty(), 'Dirty after changed');
727-
728-
$this->assertTrue($this->model->save(), 'Updated');
729-
730-
$this->assertFalse($this->model->isDirty(), 'Not dirty after update');
731-
732-
$this->assertEquals(true, $this->model->updated, 'Updated model');
733-
734-
$this->assertArrayHasKey('some', $this->model->getChanges(), 'Changes');
735-
}
736-
737671
/**
738672
* @test
739673
*/

0 commit comments

Comments
 (0)