Skip to content

Commit

Permalink
Merge pull request #26 from codebar-ag/feature-release
Browse files Browse the repository at this point in the history
Feature Release
  • Loading branch information
StanBarrows authored Sep 21, 2023
2 parents 470d7f6 + 22d73fe commit 678e45d
Show file tree
Hide file tree
Showing 12 changed files with 47 additions and 27 deletions.
6 changes: 3 additions & 3 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
blank_issues_enabled: false
contact_links:
- name: Ask a question
url: https://github.com/codebar-ag/laravel-zammad/discussions/new?category=q-a
url: https://github.com/codebar-ag/laravel-zammad/issues/new
about: Ask the community for help
- name: Request a feature
url: https://github.com/codebar-ag/laravel-zammad/discussions/new?category=ideas
url: https://github.com/codebar-ag/laravel-zammad/issues/new
about: Share ideas for new features
- name: Report a bug
url: https://github.com/codebar-ag/laravel-zammad/issues/new
about: Report a reproducable bug
about: Report a reproducable bug
2 changes: 1 addition & 1 deletion .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ jobs:
uses: ramsey/composer-install@v2

- name: Run PHPStan
run: ./vendor/bin/phpstan --error-format=github
run: ./vendor/bin/phpstan analyse src --error-format=github
6 changes: 5 additions & 1 deletion .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
max-parallel: 1
matrix:
os: [ ubuntu-latest, windows-latest ]
php: [ 8.2 ]
Expand Down Expand Up @@ -43,6 +44,9 @@ jobs:
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
composer update --${{ matrix.stability }} --prefer-dist --no-interaction
- name: Set phpunit.xml
run: cp phpunit.xml.dist phpunit.xml

- name: Execute tests
run: vendor/bin/pest
env:
Expand All @@ -56,4 +60,4 @@ jobs:
name: Store report
retention-days: 1
path: |
./reports
./reports
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ $objects = Zammad::object()->list();
'active' => true,
'position' => 1500,
'data_type' => 'select',
'data_options' => [
'data_option' => [
'options' => [
'key-one' => 'First Key',
'key-two' => 'Second Key',
Expand Down Expand Up @@ -298,7 +298,8 @@ $content = Zammad::attachment()->download(

You can use the `expand()` method to expand the response with additional data.

See documentation on this in the [Zammad API Docs](https://docs.zammad.org/en/latest/api/intro.html?highlight=expand#response-payloads-expand).
See documentation on this in
the [Zammad API Docs](https://docs.zammad.org/en/latest/api/intro.html?highlight=expand#response-payloads-expand).

```php
$ticket = Zammad::ticket()->expand()->show(20);
Expand All @@ -319,7 +320,8 @@ $user = Zammad::user()->limit(1)->search();

## Paginate list response payloads

You can use the `perPage(int $perPage)` and `page(int $page)` methods to set the page and per page values for the response
You can use the `perPage(int $perPage)` and `page(int $page)` methods to set the page and per page values for the
response
Alternatively you can use the `paginate(int $page, int $perPage):` method to set both at once.

See documentation on this in the [Zammad API Docs](https://docs.zammad.org/en/latest/api/intro.html#pagination).
Expand Down Expand Up @@ -407,7 +409,6 @@ CodebarAg\Zammad\DTO\ObjectAttribute {
}
```


## 🔧 Configuration file

You can publish the config file with:
Expand Down
20 changes: 12 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,28 +15,32 @@
"email": "[email protected]",
"homepage": "https://www.codebar.ch",
"role": "Developer"
},
{
"name": "Rhys Lees",
"role": "Software-Developer"
}
],
"require": {
"php": "^8.2",
"guzzlehttp/guzzle": "^7.5",
"illuminate/contracts": "^10.0",
"spatie/laravel-package-tools": "^1.9.2",
"sammyjo20/saloon": "^2.0",
"sammyjo20/saloon-laravel": "^2.0"
"saloonphp/laravel-plugin": "^2.1",
"saloonphp/saloon": "^2.11"
},
"require-dev": {
"laravel/pint": "^1.0",
"nunomaduro/collision": "^7.9",
"nunomaduro/larastan": "^2.0.1",
"orchestra/testbench": "^8.0",
"laravel/pint": "^1.5",
"nunomaduro/collision": "^7.0",
"nunomaduro/larastan": "^2.4.0",
"pestphp/pest": "^2.0",
"pestphp/pest-plugin-arch": "^2.0",
"orchestra/testbench": "^8.0",
"pestphp/pest-plugin-laravel": "^2.0",
"pestphp/pest-plugin-arch": "^2.0",
"phpstan/extension-installer": "^1.1",
"phpstan/phpstan-deprecation-rules": "^1.0",
"phpstan/phpstan-phpunit": "^1.0",
"spatie/laravel-ray": "^1.26"
"spatie/laravel-ray": "^1.9"
},
"autoload": {
"psr-4": {
Expand Down
6 changes: 3 additions & 3 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.1/phpunit.xsd" backupGlobals="false"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.3/phpunit.xsd" backupGlobals="false"
bootstrap="vendor/autoload.php" colors="true" processIsolation="false" stopOnFailure="false"
executionOrder="random" failOnWarning="true" failOnRisky="true" failOnEmptyTestSuite="true"
beStrictAboutOutputDuringTests="true" cacheDirectory=".phpunit.cache" backupStaticProperties="false">
Expand All @@ -20,12 +20,12 @@
<junit outputFile="build/report.junit.xml"/>
</logging>
<php>
<env name="ZAMMAD_URL" value="https://domain.zammad.com"/>
<env name="ZAMMAD_URL" value="https://dev-immospace.zammad.com"/>
<env name="ZAMMAD_TOKEN" value="token"/>
</php>
<source>
<include>
<directory suffix=".php">./src</directory>
</include>
</source>
</phpunit>
</phpunit>
2 changes: 1 addition & 1 deletion src/Resources/TicketResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@

class TicketResource extends RequestClass
{
use HasLimit;
use HasExpand;
use HasLimit;
use HasPagination;

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Resources/UserResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@

class UserResource extends RequestClass
{
use HasLimit;
use HasExpand;
use HasLimit;
use HasPagination;

/**
Expand Down
1 change: 1 addition & 0 deletions tests/Feature/AttachmentResourceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

use CodebarAg\Zammad\Events\ZammadResponseLog;
use CodebarAg\Zammad\Zammad;
use Illuminate\Support\Facades\Event;
use Illuminate\Support\Str;

it('can download an attachment', function () {
Expand Down
17 changes: 13 additions & 4 deletions tests/Feature/ObjectAttributeResourceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
$this->assertInstanceOf(Collection::class, $objects);
$this->assertTrue($objects->count() > 0);
Event::assertDispatched(ZammadResponseLog::class, 1);
})->group('objects');
})->group('objects', 'list-objects');

it('shows a object', function () {
$objects = (new Zammad())->object()->list();
Expand All @@ -21,16 +21,21 @@
$newObject = (new Zammad())->object()->show($object->id);
$this->assertSame($object->id, $newObject->id);
Event::assertDispatched(ZammadResponseLog::class, 2);
})->group('objects');
})->group('objects', 'show-object');

it('creates a object', function () {
$objectAttribute = ObjectAttribute::fakeCreateToArray();
$object = (new Zammad())->object()->create($objectAttribute);

$this->assertInstanceOf(ObjectAttribute::class, $object);
$this->assertSame($objectAttribute['name'], $object->name);
$this->assertSame($objectAttribute['display'], $object->display);
Event::assertDispatched(ZammadResponseLog::class, 1);
})->group('objects');

(new Zammad())->object()->delete($object->id);
(new Zammad())->object()->executeMigrations();

})->group('objects', 'create-object');

it('update a object', function () {
$objectAttribute = ObjectAttribute::fakeCreateToArray();
Expand Down Expand Up @@ -62,7 +67,11 @@
Event::assertDispatched(ZammadResponseLog::class, 2);
expect($updatedObjectAttribute['display'])->toEqual($object->display);
expect($objectAttribute['display'])->not()->toEqual($object->display);
})->group('objects');

(new Zammad())->object()->delete($object->id);
(new Zammad())->object()->executeMigrations();

})->group('objects', 'update-object');

it('deletes a object', function () {
$objectAttribute = ObjectAttribute::fakeCreateToArray();
Expand Down
1 change: 1 addition & 0 deletions tests/Feature/UserAccessTokenRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use CodebarAg\Zammad\Zammad;
use Illuminate\Support\Facades\Event;
use Illuminate\Support\Str;

use function PHPUnit\Framework\assertSame;

it('lists user tokens', function () {
Expand Down
2 changes: 1 addition & 1 deletion tests/Feature/UserResourceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
});

Event::assertDispatched(ZammadResponseLog::class, 1);
})->group('users');
})->group('users', 'list-users');

it('searches a user', function () {
$users = (new Zammad())->user()->paginate(1, 100)->list();
Expand Down

0 comments on commit 678e45d

Please sign in to comment.