|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* This file is part of the Bukashk0zzzYmlGenerator |
|
5
|
|
|
* |
|
6
|
|
|
* (c) Denis Golubovskiy <[email protected]> |
|
7
|
|
|
* |
|
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
|
9
|
|
|
* file that was distributed with this source code. |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
namespace Bukashk0zzz\YmlGenerator\Tests; |
|
13
|
|
|
|
|
14
|
|
|
use Bukashk0zzz\YmlGenerator\Model\Offer\OfferCustom; |
|
15
|
|
|
use Bukashk0zzz\YmlGenerator\Model\Offer\OfferParam; |
|
16
|
|
|
|
|
17
|
|
|
/** |
|
18
|
|
|
* Generator test |
|
19
|
|
|
* |
|
20
|
|
|
* @author Denis Golubovskiy <[email protected]> |
|
21
|
|
|
*/ |
|
22
|
|
|
class OfferCustomGeneratorTest extends AbstractGeneratorTest |
|
23
|
|
|
{ |
|
24
|
|
|
/** |
|
25
|
|
|
* Test generate |
|
26
|
|
|
*/ |
|
27
|
|
|
public function testGenerate() |
|
28
|
|
|
{ |
|
29
|
|
|
$this->offerType = 'Custom'; |
|
30
|
|
|
$this->runGeneratorTest(); |
|
31
|
|
|
} |
|
32
|
|
|
|
|
33
|
|
|
/** |
|
34
|
|
|
* @return array |
|
35
|
|
|
*/ |
|
36
|
|
|
protected function createOffers() |
|
37
|
|
|
{ |
|
38
|
|
|
$offers = []; |
|
39
|
|
|
foreach (range(1, 5) as $offer) { |
|
40
|
|
|
$offers[] = (new OfferCustom()) |
|
41
|
|
|
->setId($offer) |
|
42
|
|
|
->setAvailable($this->faker->boolean) |
|
43
|
|
|
->setUrl($this->faker->url) |
|
44
|
|
|
->setPrice($this->faker->numberBetween(1, 9999)) |
|
45
|
|
|
->setCurrencyId('UAH') |
|
46
|
|
|
->setCategoryId($offer) |
|
47
|
|
|
->setName($this->faker->name) |
|
48
|
|
|
->setDelivery($this->faker->boolean) |
|
49
|
|
|
->setLocalDeliveryCost($this->faker->numberBetween(1, 9999)) |
|
50
|
|
|
->setVendor($this->faker->company) |
|
51
|
|
|
->setVendorCode($this->faker->companySuffix) |
|
52
|
|
|
->setDescription($this->faker->sentence) |
|
53
|
|
|
->setCountryOfOrigin('Украина') |
|
54
|
|
|
->setAdult($this->faker->boolean) |
|
55
|
|
|
->setTypePrefix($this->faker->colorName) |
|
56
|
|
|
->setModel($this->faker->userName) |
|
57
|
|
|
->setSalesNotes($this->faker->text(45)) |
|
58
|
|
|
->setManufacturerWarranty($this->faker->boolean) |
|
59
|
|
|
->setDownloadable($this->faker->boolean) |
|
60
|
|
|
->addParam( |
|
61
|
|
|
(new OfferParam()) |
|
62
|
|
|
->setName($this->faker->name) |
|
63
|
|
|
->setUnit($this->faker->text(5)) |
|
64
|
|
|
->setValue($this->faker->text(10)) |
|
65
|
|
|
) |
|
66
|
|
|
; |
|
67
|
|
|
} |
|
68
|
|
|
|
|
69
|
|
|
return $offers; |
|
70
|
|
|
} |
|
71
|
|
|
} |
|
72
|
|
|
|