Skip to content

Commit

Permalink
Reset failed at after a succesful update (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
ramonrietdijk authored Sep 11, 2024
1 parent ca420f7 commit 010a04e
Show file tree
Hide file tree
Showing 64 changed files with 236 additions and 197 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ jobs:

- name: Install dependencies
run: |
composer config allow-plugins.pestphp/pest-plugin true
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" pestphp/pest --no-interaction --no-update
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
composer update --${{ matrix.stability }} --prefer-dist --no-interaction
- name: Execute tests
run: XDEBUG_MODE=coverage php vendor/bin/pest --coverage --min=100
134 changes: 68 additions & 66 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,69 +1,71 @@
{
"name": "justbetter/laravel-akeneo-products",
"description": "Easily export products to Akeneo from your ERP",
"type": "package",
"license": "MIT",
"homepage": "https://github.com/justbetter/laravel-akeneo-products",
"authors": [
{
"name": "Ramon Rietdijk",
"email": "[email protected]",
"role": "Developer"
},
{
"name": "Vincent Boon",
"email": "[email protected]",
"role": "Developer"
}
],
"require": {
"php": "^8.1",
"justbetter/laravel-akeneo-client": "^1.1",
"justbetter/laravel-error-logger": "^2.3",
"laravel/framework": "^10.0|^11.0",
"spatie/laravel-activitylog": "^4.7"
},
"require-dev": {
"larastan/larastan": "^2.9",
"laravel/pint": "^1.10",
"orchestra/testbench": "^8.0|^9.0",
"phpstan/phpstan-mockery": "^1.1",
"phpunit/phpunit": "^10.1"
},
"autoload": {
"psr-4": {
"JustBetter\\AkeneoProducts\\": "src"
}
},
"autoload-dev": {
"psr-4": {
"JustBetter\\AkeneoProducts\\Tests\\": "tests"
}
},
"scripts": {
"test": "phpunit",
"analyse": "phpstan",
"style": "pint --test",
"quality": [
"@test",
"@analyse",
"@style"
"name": "justbetter/laravel-akeneo-products",
"description": "Easily export products to Akeneo from your ERP",
"type": "package",
"license": "MIT",
"homepage": "https://github.com/justbetter/laravel-akeneo-products",
"authors": [
{
"name": "Ramon Rietdijk",
"email": "[email protected]",
"role": "Developer"
},
{
"name": "Vincent Boon",
"email": "[email protected]",
"role": "Developer"
}
],
"fix-style": "pint"
},
"config": {
"sort-packages": true,
"allow-plugins": {
"php-http/discovery": true
}
},
"extra": {
"laravel": {
"providers": [
"JustBetter\\AkeneoProducts\\ServiceProvider"
]
}
},
"minimum-stability": "dev",
"prefer-stable": true
"require": {
"php": "^8.1",
"justbetter/laravel-akeneo-client": "^1.1",
"justbetter/laravel-error-logger": "^2.3",
"laravel/framework": "^10.0|^11.0",
"spatie/laravel-activitylog": "^4.7"
},
"require-dev": {
"larastan/larastan": "^2.9",
"laravel/pint": "^1.17",
"orchestra/testbench": "^8.0|^9.0",
"pestphp/pest": "^2.35",
"phpstan/phpstan-mockery": "^1.1",
"phpunit/phpunit": "^10.5"
},
"autoload": {
"psr-4": {
"JustBetter\\AkeneoProducts\\": "src"
}
},
"autoload-dev": {
"psr-4": {
"JustBetter\\AkeneoProducts\\Tests\\": "tests"
}
},
"scripts": {
"test": "phpunit",
"analyse": "phpstan",
"style": "pint --test",
"quality": [
"@test",
"@analyse",
"@style"
],
"fix-style": "pint"
},
"config": {
"sort-packages": true,
"allow-plugins": {
"php-http/discovery": true,
"pestphp/pest-plugin": true
}
},
"extra": {
"laravel": {
"providers": [
"JustBetter\\AkeneoProducts\\ServiceProvider"
]
}
},
"minimum-stability": "dev",
"prefer-stable": true
}
5 changes: 3 additions & 2 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ parameters:
- src
- tests
level: 8
checkMissingIterableValueType: false
checkGenericClassInNonGenericObjectType: false
ignoreErrors:
- identifier: missingType.iterableValue
- identifier: missingType.generics
2 changes: 1 addition & 1 deletion phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?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" bootstrap="vendor/autoload.php" colors="true">
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd" bootstrap="vendor/autoload.php" colors="true">
<testsuites>
<testsuite name="Tests">
<directory>./tests/*</directory>
Expand Down
3 changes: 1 addition & 2 deletions src/Actions/Akeneo/CreateAttributeOption.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ class CreateAttributeOption implements CreatesAttributeOptions
public function __construct(
protected Akeneo $akeneo,
protected GetsAttributeOptions $getsAttributeOptions
) {
}
) {}

public function create(string $code, string $optionCode, array $data): AttributeOptionData
{
Expand Down
3 changes: 1 addition & 2 deletions src/Actions/Akeneo/FormatAttributeValues.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ public function __construct(
protected TypeFactory $typeFactory,
protected GetsScopes $getsScopes,
protected GetsLocales $getsLocales
) {
}
) {}

public function format(string $attributeCode, mixed $value): array
{
Expand Down
3 changes: 1 addition & 2 deletions src/Actions/Akeneo/GetAttribute.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ class GetAttribute implements GetsAttributes
{
public function __construct(
protected Akeneo $akeneo
) {
}
) {}

public function get(string $code): AttributeData
{
Expand Down
3 changes: 1 addition & 2 deletions src/Actions/Akeneo/GetAttributeOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ class GetAttributeOptions implements GetsAttributeOptions
{
public function __construct(
protected Akeneo $akeneo
) {
}
) {}

public function get(string $code): Enumerable
{
Expand Down
5 changes: 2 additions & 3 deletions src/Actions/Akeneo/GetLocales.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,15 @@ class GetLocales implements GetsLocales
{
public function __construct(
protected Akeneo $akeneo
) {
}
) {}

public function get(): Enumerable
{
$key = 'akeneo-products:locales';
$ttl = now()->addDay();

$locales = Cache::remember($key, $ttl, function (): array {
$search = new SearchBuilder();
$search = new SearchBuilder;
$search->addFilter('enabled', '=', true);

$locales = [];
Expand Down
3 changes: 1 addition & 2 deletions src/Actions/Akeneo/GetScopes.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ class GetScopes implements GetsScopes
{
public function __construct(
protected Akeneo $akeneo
) {
}
) {}

public function get(): Enumerable
{
Expand Down
3 changes: 1 addition & 2 deletions src/Actions/Akeneo/ResolveAttributeOption.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ public function __construct(
protected GetsAttributeOptions $getsAttributeOptions,
protected GetsLocales $getsLocales,
protected CreatesAttributeOptions $createsAttributeOptions
) {
}
) {}

public function resolve(string $code, string $optionCode, string $label): AttributeOptionData
{
Expand Down
5 changes: 3 additions & 2 deletions src/Actions/Product/UpdateProduct.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,16 @@ class UpdateProduct implements UpdatesProduct
{
public function __construct(
protected Akeneo $akeneo
) {
}
) {}

public function update(Product $product): void
{
$this->akeneo->getProductApi()->upsert($product->identifier, $product->data);

$product->modified_at = now();
$product->update = false;
$product->fail_count = 0;
$product->failed_at = null;
$product->save();
}

Expand Down
5 changes: 3 additions & 2 deletions src/Actions/ProductModel/UpdateProductModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ class UpdateProductModel implements UpdatesProductModel
{
public function __construct(
protected Akeneo $akeneo
) {
}
) {}

public function update(ProductModel $productModel): void
{
Expand All @@ -23,6 +22,8 @@ public function update(ProductModel $productModel): void

$productModel->modified_at = now();
$productModel->update = false;
$productModel->fail_count = 0;
$productModel->failed_at = null;
$productModel->save();
}

Expand Down
3 changes: 1 addition & 2 deletions src/Akeneo/Types/BaseType.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ abstract class BaseType

public function __construct(
protected Akeneo $akeneo
) {
}
) {}

public function matches(string $type): bool
{
Expand Down
3 changes: 2 additions & 1 deletion tests/Actions/Akeneo/CreateAttributeOptionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@
use JustBetter\AkeneoProducts\Data\AttributeOptionData;
use JustBetter\AkeneoProducts\Tests\TestCase;
use Mockery\MockInterface;
use PHPUnit\Framework\Attributes\Test;

class CreateAttributeOptionTest extends TestCase
{
/** @test */
#[Test]
public function it_can_create_attribute_options(): void
{
Akeneo::fake();
Expand Down
9 changes: 5 additions & 4 deletions tests/Actions/Akeneo/FormatAttributeValuesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@
use JustBetter\AkeneoProducts\Data\ScopeData;
use JustBetter\AkeneoProducts\Tests\TestCase;
use Mockery\MockInterface;
use PHPUnit\Framework\Attributes\Test;

class FormatAttributeValuesTest extends TestCase
{
/** @test */
#[Test]
public function it_can_format_attribute_values_unscoped_unlocalized(): void
{
Akeneo::fake();
Expand Down Expand Up @@ -75,7 +76,7 @@ public function it_can_format_attribute_values_unscoped_unlocalized(): void
], $values);
}

/** @test */
#[Test]
public function it_can_format_attribute_values_unscoped_localized(): void
{
Akeneo::fake();
Expand Down Expand Up @@ -134,7 +135,7 @@ public function it_can_format_attribute_values_unscoped_localized(): void
], $values);
}

/** @test */
#[Test]
public function it_can_format_attribute_values_scoped_unlocalized(): void
{
Akeneo::fake();
Expand Down Expand Up @@ -193,7 +194,7 @@ public function it_can_format_attribute_values_scoped_unlocalized(): void
], $values);
}

/** @test */
#[Test]
public function it_can_format_attribute_values_scoped_localized(): void
{
Akeneo::fake();
Expand Down
3 changes: 2 additions & 1 deletion tests/Actions/Akeneo/GetAttributeOptionsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@
use JustBetter\AkeneoClient\Client\Akeneo;
use JustBetter\AkeneoProducts\Actions\Akeneo\GetAttributeOptions;
use JustBetter\AkeneoProducts\Tests\TestCase;
use PHPUnit\Framework\Attributes\Test;

class GetAttributeOptionsTest extends TestCase
{
/** @test */
#[Test]
public function it_can_attribute_options(): void
{
Akeneo::fake();
Expand Down
3 changes: 2 additions & 1 deletion tests/Actions/Akeneo/GetAttributeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@
use JustBetter\AkeneoClient\Client\Akeneo;
use JustBetter\AkeneoProducts\Actions\Akeneo\GetAttribute;
use JustBetter\AkeneoProducts\Tests\TestCase;
use PHPUnit\Framework\Attributes\Test;

class GetAttributeTest extends TestCase
{
/** @test */
#[Test]
public function it_can_get_attributes(): void
{
Akeneo::fake();
Expand Down
3 changes: 2 additions & 1 deletion tests/Actions/Akeneo/GetLocalesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@
use JustBetter\AkeneoClient\Client\Akeneo;
use JustBetter\AkeneoProducts\Actions\Akeneo\GetLocales;
use JustBetter\AkeneoProducts\Tests\TestCase;
use PHPUnit\Framework\Attributes\Test;

class GetLocalesTest extends TestCase
{
/** @test */
#[Test]
public function it_can_get_locales(): void
{
Akeneo::fake();
Expand Down
3 changes: 2 additions & 1 deletion tests/Actions/Akeneo/GetScopesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@
use JustBetter\AkeneoClient\Client\Akeneo;
use JustBetter\AkeneoProducts\Actions\Akeneo\GetScopes;
use JustBetter\AkeneoProducts\Tests\TestCase;
use PHPUnit\Framework\Attributes\Test;

class GetScopesTest extends TestCase
{
/** @test */
#[Test]
public function it_can_get_scopes(): void
{
Akeneo::fake();
Expand Down
Loading

0 comments on commit 010a04e

Please sign in to comment.