Skip to content

Commit ced9e1b

Browse files
authored
Merge pull request #6 from codebar-ag/feature-updates
Feature Updates
2 parents ba18b17 + d9ff1ce commit ced9e1b

13 files changed

+119
-123
lines changed

.github/workflows/phpstan.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ name: PHPStan
22

33
on:
44
push:
5-
paths:
6-
- '**.php'
7-
- 'phpstan.neon.dist'
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
88

99
jobs:
1010
phpstan:
@@ -23,4 +23,4 @@ jobs:
2323
uses: ramsey/composer-install@v2
2424

2525
- name: Run PHPStan
26-
run: ./vendor/bin/phpstan --error-format=github
26+
run: ./vendor/bin/phpstan analyse src --error-format=github

.github/workflows/run-tests.yml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,10 @@ jobs:
1212
strategy:
1313
fail-fast: true
1414
matrix:
15-
# os: [ ubuntu-latest, windows-latest ]
16-
os: [ ubuntu-latest ]
15+
os: [ ubuntu-latest, windows-latest ]
1716
php: [ 8.2 ]
1817
laravel: [ 10.* ]
19-
#stability: [ prefer-lowest, prefer-stable ]
20-
stability: [ prefer-stable ]
18+
stability: [ prefer-lowest, prefer-stable ]
2119
include:
2220
- laravel: 10.*
2321
testbench: 8.*
@@ -45,12 +43,13 @@ jobs:
4543
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
4644
composer update --${{ matrix.stability }} --prefer-dist --no-interaction
4745
46+
- name: Set phpunit.xml
47+
run: cp phpunit.xml.dist phpunit.xml
48+
4849
- name: Execute tests
4950
run: vendor/bin/pest
5051
env:
51-
ZAMMAD_URL: ${{ secrets.ZAMMAD_URL }}
52-
ZAMMAD_TOKEN: ${{ secrets.ZAMMAD_TOKEN }}
53-
ZAMMAD_OBJECT_REFERENCE_ERROR_IGNORE: true
52+
FLATFOX_TOKEN: ${{ secrets.FLATFOX_TOKEN }}
5453

5554
- name: Store test reports
5655
uses: actions/upload-artifact@v2

composer.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,24 @@
1919
],
2020
"require": {
2121
"php": "^8.2",
22-
"guzzlehttp/guzzle": "^7.2",
22+
"guzzlehttp/guzzle": "^7.5",
2323
"illuminate/contracts": "^10.0",
24-
"sammyjo20/saloon": "^2.6",
24+
"saloonphp/laravel-plugin": "^2.1",
25+
"saloonphp/saloon": "^2.11",
2526
"saloonphp/cache-plugin": "^2.1",
2627
"spatie/laravel-package-tools": "^1.9.2"
2728
},
2829
"require-dev": {
2930
"laravel/pint": "^1.5",
3031
"nunomaduro/collision": "^7.0",
3132
"nunomaduro/larastan": "^2.4.0",
33+
"pestphp/pest": "^2.0",
3234
"orchestra/testbench": "^8.0",
33-
"pestphp/pest": "2.x-dev",
34-
"pestphp/pest-plugin-laravel": "2.x-dev",
35+
"pestphp/pest-plugin-laravel": "^2.0",
36+
"pestphp/pest-plugin-arch": "^2.0",
3537
"phpstan/extension-installer": "^1.1",
3638
"phpstan/phpstan-deprecation-rules": "^1.0",
3739
"phpstan/phpstan-phpunit": "^1.0",
38-
"phpunit/phpunit": "^10.0",
3940
"spatie/laravel-ray": "^1.9"
4041
},
4142
"autoload": {

phpunit.xml.dist

Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,15 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit
3-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4-
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
5-
backupGlobals="false"
6-
backupStaticAttributes="false"
7-
bootstrap="vendor/autoload.php"
8-
colors="true"
9-
convertErrorsToExceptions="true"
10-
convertNoticesToExceptions="true"
11-
convertWarningsToExceptions="true"
12-
processIsolation="false"
13-
stopOnFailure="false"
14-
executionOrder="random"
15-
failOnWarning="true"
16-
failOnRisky="true"
17-
failOnEmptyTestSuite="true"
18-
beStrictAboutOutputDuringTests="true"
19-
verbose="true"
20-
>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.3/phpunit.xsd" backupGlobals="false"
4+
bootstrap="vendor/autoload.php" colors="true" processIsolation="false" stopOnFailure="false"
5+
executionOrder="random" failOnWarning="true" failOnRisky="true" failOnEmptyTestSuite="true"
6+
beStrictAboutOutputDuringTests="true" cacheDirectory=".phpunit.cache" backupStaticProperties="false">
217
<testsuites>
22-
<testsuite name="CodebarAg Test Suite">
8+
<testsuite name="codebar Solutions AG Test Suite">
239
<directory>tests</directory>
2410
</testsuite>
2511
</testsuites>
2612
<coverage>
27-
<include>
28-
<directory suffix=".php">./src</directory>
29-
</include>
3013
<report>
3114
<html outputDirectory="build/coverage"/>
3215
<text outputFile="build/coverage.txt"/>
@@ -39,4 +22,4 @@
3922
<php>
4023
<env name="FLATFOX_TOKEN" value="token"/>
4124
</php>
42-
</phpunit>
25+
</phpunit>

src/DTO/Agency.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@
77
class Agency
88
{
99
public function __construct(
10-
public string|null $name,
11-
public string|null $name_2,
12-
public string|null $street,
13-
public string|null $zipcode,
14-
public string|null $city,
15-
public string|null $country,
16-
public string|null $logo_url,
17-
public string|null $logo_url_org_logo_m,
10+
public ?string $name,
11+
public ?string $name_2,
12+
public ?string $street,
13+
public ?string $zipcode,
14+
public ?string $city,
15+
public ?string $country,
16+
public ?string $logo_url,
17+
public ?string $logo_url_org_logo_m,
1818
) {
1919
}
2020

src/DTO/Attribute.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
class Attribute
88
{
99
public function __construct(
10-
public string|null $name,
10+
public ?string $name,
1111
) {
1212
}
1313

src/DTO/Document.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
class Document
88
{
99
public function __construct(
10-
public int|null $pk,
11-
public string|null $url,
12-
public int|null $ordering,
13-
public string|null $caption,
10+
public ?int $pk,
11+
public ?string $url,
12+
public ?int $ordering,
13+
public ?string $caption,
1414
) {
1515
}
1616

src/DTO/Image.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@
77
class Image
88
{
99
public function __construct(
10-
public int|null $pk,
11-
public string|null $caption,
12-
public string|null $url,
13-
public string|null $url_thumb_m,
14-
public string|null $url_listing_search,
15-
public string|null $search_url,
16-
public int|null $ordering,
17-
public int|null $width,
18-
public int|null $height,
10+
public ?int $pk,
11+
public ?string $caption,
12+
public ?string $url,
13+
public ?string $url_thumb_m,
14+
public ?string $url_listing_search,
15+
public ?string $search_url,
16+
public ?int $ordering,
17+
public ?int $width,
18+
public ?int $height,
1919
) {
2020
}
2121

src/DTO/Listing.php

Lines changed: 56 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -11,65 +11,65 @@ class Listing
1111
{
1212
public function __construct(
1313
public int $pk,
14-
public string|null $slug,
15-
public array|null $url,
16-
public string|null $short_url,
17-
public array|null $submit_url,
18-
public string|null $status,
19-
public string|null $offer_type,
20-
public string|null $object_category,
21-
public string|null $object_type,
22-
public string|null $reference,
23-
public string|null $ref_property,
24-
public string|null $ref_house,
25-
public string|null $ref_object,
26-
public string|null $alternative_reference,
27-
public int|null $price_display,
28-
public string|null $price_display_type,
29-
public string|null $price_unit,
30-
public int|null $rent_net,
31-
public int|null $rent_charges,
32-
public int|null $rent_gross,
33-
public string|null $short_title,
34-
public string|null $public_title,
35-
public string|null $pitch_title,
36-
public string|null $description_title,
37-
public string|null $description,
38-
public int|null $surface_living,
39-
public int|null $surface_property,
40-
public int|null $surface_usable,
41-
public int|null $surface_usable_minimum,
42-
public int|null $volume,
43-
public int|null $space_display,
44-
public string|null $number_of_rooms,
45-
public int|null $floor,
46-
public Collection|null $attributes,
14+
public ?string $slug,
15+
public ?array $url,
16+
public ?string $short_url,
17+
public ?array $submit_url,
18+
public ?string $status,
19+
public ?string $offer_type,
20+
public ?string $object_category,
21+
public ?string $object_type,
22+
public ?string $reference,
23+
public ?string $ref_property,
24+
public ?string $ref_house,
25+
public ?string $ref_object,
26+
public ?string $alternative_reference,
27+
public ?int $price_display,
28+
public ?string $price_display_type,
29+
public ?string $price_unit,
30+
public ?int $rent_net,
31+
public ?int $rent_charges,
32+
public ?int $rent_gross,
33+
public ?string $short_title,
34+
public ?string $public_title,
35+
public ?string $pitch_title,
36+
public ?string $description_title,
37+
public ?string $description,
38+
public ?int $surface_living,
39+
public ?int $surface_property,
40+
public ?int $surface_usable,
41+
public ?int $surface_usable_minimum,
42+
public ?int $volume,
43+
public ?int $space_display,
44+
public ?string $number_of_rooms,
45+
public ?int $floor,
46+
public ?Collection $attributes,
4747
public bool $is_furnished,
4848
public bool $is_temporary,
4949
public bool $is_selling_furniture,
50-
public string|null $street,
51-
public int|null $zipcode,
52-
public string|null $city,
53-
public string|null $public_address,
54-
public float|null $latitude,
55-
public float|null $longitude,
56-
public int|null $year_built,
57-
public int|null $year_renovated,
58-
public string|null $moving_date_type,
59-
public Carbon|null $moving_date,
60-
public string|null $video_url,
61-
public string|null $tour_url,
62-
public string|null $website_url,
63-
public string|null $live_viewing_url,
64-
public int|null $cover_image,
65-
public Collection|null $images,
66-
public Collection|null $documents,
67-
public Agency|null $agency,
50+
public ?string $street,
51+
public ?int $zipcode,
52+
public ?string $city,
53+
public ?string $public_address,
54+
public ?float $latitude,
55+
public ?float $longitude,
56+
public ?int $year_built,
57+
public ?int $year_renovated,
58+
public ?string $moving_date_type,
59+
public ?Carbon $moving_date,
60+
public ?string $video_url,
61+
public ?string $tour_url,
62+
public ?string $website_url,
63+
public ?string $live_viewing_url,
64+
public ?int $cover_image,
65+
public ?Collection $images,
66+
public ?Collection $documents,
67+
public ?Agency $agency,
6868
public bool $reserved,
69-
public string|null $rent_title,
70-
public int|null $livingspace,
71-
public Carbon|null $published,
72-
public Carbon|null $created,
69+
public ?string $rent_title,
70+
public ?int $livingspace,
71+
public ?Carbon $published,
72+
public ?Carbon $created,
7373
) {
7474
}
7575

@@ -84,7 +84,7 @@ public static function fromJson(array $data): self
8484
pk: Arr::get($data, 'pk'),
8585
slug: Arr::get($data, 'slug'),
8686
url: [
87-
'de' => Str::replace('/en/', '/de/', $url),
87+
'de' => Str::replace('/en/flat/', '/de/wohnung/', $url),
8888
'en' => $url,
8989
'fr' => Str::replace('/en/', '/fr/', $url),
9090
'it' => Str::replace('/en/', '/it/', $url),

src/Requests/GetPublicListing.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public function resolveEndpoint(): string
2727

2828
public function __construct(
2929
protected string $identifier,
30-
protected string|null $expand = null,
30+
protected ?string $expand = null,
3131
) {
3232
}
3333

@@ -47,7 +47,7 @@ public function createDtoFromResponse(Response $response): mixed
4747
protected function defaultConfig(): array
4848
{
4949
return [
50-
'timeout' => config('flatfox.caching', 15),
50+
'timeout' => config('flatfox.timeout', 15),
5151
];
5252
}
5353

src/Response/PublicListing.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ final class PublicListing
1111
{
1212
public function __construct(
1313
public int $count,
14-
public string|null $next,
15-
public string|null $previous,
16-
public Collection|null $results,
14+
public ?string $next,
15+
public ?string $previous,
16+
public ?Collection $results,
1717
) {
1818
}
1919

tests/Feature/GetPublicListingTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,22 @@
33
namespace CodebarAg\FlatFox\Tests\Feature;
44

55
use CodebarAg\Flatfox\Requests\GetPublicListing;
6+
use Saloon\Http\Faking\MockClient;
7+
use Saloon\Http\Faking\MockResponse;
68

79
it('get public listing', function () {
10+
11+
$mockClient = new MockClient([
12+
GetPublicListing::class => MockResponse::fixture('get-public-listing-request'),
13+
]);
14+
815
$request = new GetPublicListing(142, '&expand=documents&expand=images');
16+
$request->withMockClient($mockClient);
17+
918
$response = $request->send();
19+
20+
$mockClient->assertSent(GetPublicListing::class);
21+
1022
expect($response->status())->toBe(200)
1123
->and($response->dto())->not()->toBeEmpty();
1224
})

tests/Fixtures/Saloon/get-public-listing-request.json

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)