-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
236 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace Scraper\ScraperPrestashop\Entity\CadoMaestro; | ||
|
||
use Scraper\ScraperPrestashop\Entity\PrestashopItem; | ||
|
||
class PrestashopPackage | ||
{ | ||
public ?int $id = null; | ||
public ?string $idPackageType = null; | ||
/** @var array<int, PrestashopItem> */ | ||
public array $name = []; | ||
/** @var array<int, PrestashopItem> */ | ||
public array $picto = []; | ||
public ?string $default = null; | ||
public ?string $actif = null; | ||
public ?string $dateAdd = null; | ||
public ?string $dateUpd = null; | ||
|
||
public function addName(PrestashopItem $name): self | ||
{ | ||
$this->name[] = $name; | ||
return $this; | ||
} | ||
|
||
public function addPicto(PrestashopItem $picto): self | ||
{ | ||
$this->picto[] = $picto; | ||
return $this; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace Scraper\ScraperPrestashop\Entity\CadoMaestro; | ||
|
||
class PrestashopPackageType | ||
{ | ||
public ?int $id = null; | ||
public ?string $name = null; | ||
public ?string $sentence = null; | ||
public ?string $price = null; | ||
public ?string $idProduct = null; | ||
public ?string $actif = null; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace Scraper\ScraperPrestashop\Entity\CadoMaestro; | ||
|
||
class PrestashopPackageTypes | ||
{ | ||
/** @var array<int, PrestashopPackageType> */ | ||
public array $packageTypes = []; | ||
|
||
public function addPackageType(PrestashopPackageType $packageType): self | ||
{ | ||
$this->packageTypes[] = $packageType; | ||
return $this; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace Scraper\ScraperPrestashop\Entity\CadoMaestro; | ||
|
||
class PrestashopPackages | ||
{ | ||
/** @var array<int, PrestashopPackage> */ | ||
public array $packages = []; | ||
|
||
public function addPackage(PrestashopPackage $package): self | ||
{ | ||
$this->packages[] = $package; | ||
return $this; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace Scraper\ScraperPrestashop\Tests\Api; | ||
|
||
use Scraper\ScraperPrestashop\Entity\CadoMaestro\PrestashopPackage; | ||
use Scraper\ScraperPrestashop\Entity\CadoMaestro\PrestashopPackages; | ||
use Scraper\ScraperPrestashop\Entity\PrestashopStockAvailable; | ||
use Scraper\ScraperPrestashop\Entity\PrestashopStockAvailables; | ||
|
||
/** | ||
* @internal | ||
*/ | ||
class PrestashopPackageApiTest extends AbstractPrestashopApiTestCase | ||
{ | ||
public function testOne(): void | ||
{ | ||
/** @var PrestashopStockAvailable $result */ | ||
$result = $this->executeGetApi( | ||
'packages', | ||
1, | ||
200, | ||
'package.json' | ||
); | ||
|
||
$this->assertInstanceOf(PrestashopPackage::class, $result); | ||
|
||
$this->assertEquals(1, $result->id); | ||
} | ||
|
||
public function testList(): void | ||
{ | ||
/** @var PrestashopStockAvailables $result */ | ||
$result = $this->executeGetApi( | ||
'packages', | ||
null, | ||
200, | ||
'packages.json' | ||
); | ||
|
||
$this->assertInstanceOf(PrestashopPackages::class, $result); | ||
$this->assertCount(2, $result->packages); | ||
$this->assertInstanceOf(PrestashopPackage::class, $result->packages[0]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace Scraper\ScraperPrestashop\Tests\Api; | ||
|
||
use Scraper\ScraperPrestashop\Entity\CadoMaestro\PrestashopPackageType; | ||
use Scraper\ScraperPrestashop\Entity\CadoMaestro\PrestashopPackageTypes; | ||
use Scraper\ScraperPrestashop\Entity\PrestashopStockAvailable; | ||
use Scraper\ScraperPrestashop\Entity\PrestashopStockAvailables; | ||
|
||
/** | ||
* @internal | ||
*/ | ||
class PrestashopPackageTypeApiTest extends AbstractPrestashopApiTestCase | ||
{ | ||
public function testOne(): void | ||
{ | ||
/** @var PrestashopStockAvailable $result */ | ||
$result = $this->executeGetApi( | ||
'package_types', | ||
1, | ||
200, | ||
'package_type.json' | ||
); | ||
|
||
$this->assertInstanceOf(PrestashopPackageType::class, $result); | ||
|
||
$this->assertEquals(1, $result->id); | ||
} | ||
|
||
public function testList(): void | ||
{ | ||
/** @var PrestashopStockAvailables $result */ | ||
$result = $this->executeGetApi( | ||
'package_types', | ||
null, | ||
200, | ||
'package_types.json' | ||
); | ||
|
||
$this->assertInstanceOf(PrestashopPackageTypes::class, $result); | ||
$this->assertCount(2, $result->packageTypes); | ||
$this->assertInstanceOf(PrestashopPackageType::class, $result->packageTypes[0]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
"package": { | ||
"id": 1, | ||
"id_package_type": "1", | ||
"name": [ | ||
{ | ||
"id": "1", | ||
"value": "Papier ananas jaune" | ||
}, | ||
{ | ||
"id": "8", | ||
"value": "Ananas - Ananas" | ||
} | ||
], | ||
"picto": [ | ||
{ | ||
"id": "1", | ||
"value": "/img/nq_packaging/pictos/package1-ananas.jpg" | ||
}, | ||
{ | ||
"id": "8", | ||
"value": "/img/nq_packaging/pictos/package1-Ananas.jpg" | ||
} | ||
], | ||
"default": "0", | ||
"actif": "1", | ||
"date_add": "2019-11-13 14:52:10", | ||
"date_upd": "2023-05-04 10:49:36" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"package_type": { | ||
"id": 1, | ||
"name": "Papier cadeau", | ||
"sentence": "Choisissez votre papier cadeau", | ||
"price": "3.950000", | ||
"id_product": "11587", | ||
"actif": "0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"package_types": [ | ||
{ | ||
"id": 1 | ||
}, | ||
{ | ||
"id": 2 | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"packages": [ | ||
{ | ||
"id": 1 | ||
}, | ||
{ | ||
"id": 2 | ||
} | ||
] | ||
} |