ver. 0.291: ShopProducer frontend migration to Domain + Controllers
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -301,6 +301,34 @@ class ProducerRepository
|
||||
return is_array($rows) ? array_map('intval', $rows) : [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Aktywni producenci z pelnym danymi (frontend lista).
|
||||
*
|
||||
* @return array<int, array{id: int, name: string, img: string|null}>
|
||||
*/
|
||||
public function allActiveProducers(): array
|
||||
{
|
||||
$rows = $this->db->select('pp_shop_producer', ['id', 'name', 'img'], [
|
||||
'status' => 1,
|
||||
'ORDER' => ['name' => 'ASC'],
|
||||
]);
|
||||
|
||||
if (!is_array($rows)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$producers = [];
|
||||
foreach ($rows as $row) {
|
||||
$producers[] = [
|
||||
'id' => (int)($row['id'] ?? 0),
|
||||
'name' => (string)($row['name'] ?? ''),
|
||||
'img' => $row['img'] ?? null,
|
||||
];
|
||||
}
|
||||
|
||||
return $producers;
|
||||
}
|
||||
|
||||
private function defaultProducer(): array
|
||||
{
|
||||
return [
|
||||
|
||||
62
autoload/front/Controllers/ShopProducerController.php
Normal file
62
autoload/front/Controllers/ShopProducerController.php
Normal file
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
namespace front\Controllers;
|
||||
|
||||
use Domain\Producer\ProducerRepository;
|
||||
|
||||
class ShopProducerController
|
||||
{
|
||||
private ProducerRepository $repository;
|
||||
|
||||
public function __construct( ProducerRepository $repository )
|
||||
{
|
||||
$this->repository = $repository;
|
||||
}
|
||||
|
||||
public function products()
|
||||
{
|
||||
global $page, $lang_id;
|
||||
|
||||
$producerId = (int)\Shared\Helpers\Helpers::get( 'producer_id' );
|
||||
$producer = $this->repository->findForFrontend( $producerId, $lang_id );
|
||||
|
||||
if ( !$producer )
|
||||
return '';
|
||||
|
||||
$page['show_title'] = true;
|
||||
$page['language']['title'] = $producer['name'];
|
||||
|
||||
$bs = (int)\Shared\Helpers\Helpers::get( 'bs' );
|
||||
$results = $this->repository->producerProducts( $producer['id'], 12, $bs ?: 1 );
|
||||
|
||||
$pager = '';
|
||||
if ( $results['ls'] > 1 )
|
||||
{
|
||||
$pager = \Shared\Tpl\Tpl::view( 'site/pager', [
|
||||
'ls' => $results['ls'],
|
||||
'bs' => $bs ?: 1,
|
||||
'page' => $page,
|
||||
'link' => 'producent/' . \Shared\Helpers\Helpers::seo( $producer['name'] )
|
||||
] );
|
||||
}
|
||||
|
||||
return \Shared\Tpl\Tpl::view( 'shop-producer/products', [
|
||||
'producer' => $producer,
|
||||
'products' => $results['products'],
|
||||
'pager' => $pager
|
||||
] );
|
||||
}
|
||||
|
||||
public function list()
|
||||
{
|
||||
global $page;
|
||||
|
||||
$page['show_title'] = true;
|
||||
$page['language']['title'] = 'Producenci';
|
||||
|
||||
$producers = $this->repository->allActiveProducers();
|
||||
|
||||
return \Shared\Tpl\Tpl::view( 'shop-producer/list', [
|
||||
'producers' => $producers
|
||||
] );
|
||||
}
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
<?
|
||||
namespace front\controls;
|
||||
class ShopProducer
|
||||
{
|
||||
static public function products()
|
||||
{
|
||||
global $page, $lang_id;
|
||||
|
||||
$producer = new \shop\Producer( \Shared\Helpers\Helpers::get( 'producer_id' ) );
|
||||
|
||||
$page['show_title'] = true;
|
||||
$page['language']['title'] = $producer['name'];
|
||||
|
||||
$results = \shop\Producer::producer_products( $producer['id'], $lang_id, (int) \Shared\Helpers\Helpers::get( 'bs' ) );
|
||||
|
||||
if ( $results['ls'] > 1 )
|
||||
{
|
||||
$pager = \Shared\Tpl\Tpl::view( 'site/pager', [
|
||||
'ls' => $results['ls'],
|
||||
'bs' => (int) \Shared\Helpers\Helpers::get( 'bs' ) ? (int) \Shared\Helpers\Helpers::get( 'bs' ) : 1,
|
||||
'page' => $page,
|
||||
'link' => 'producent/' . \Shared\Helpers\Helpers::seo( $producer['name'] )
|
||||
] );
|
||||
}
|
||||
|
||||
return \Shared\Tpl\Tpl::view( 'shop-producer/products', [
|
||||
'producer' => $producer,
|
||||
'products' => $results['products'],
|
||||
'pager' => $pager
|
||||
] );
|
||||
}
|
||||
|
||||
static public function list()
|
||||
{
|
||||
global $mdb, $page;
|
||||
|
||||
$page['show_title'] = true;
|
||||
$page['language']['title'] = 'Producenci';
|
||||
|
||||
$rows = $mdb -> select( 'pp_shop_producer', 'id', [ 'status' => 1, 'ORDER' => [ 'name' => 'ASC' ] ] );
|
||||
if ( \Shared\Helpers\Helpers::is_array_fix( $rows ) ) foreach ( $rows as $row )
|
||||
$producers[] = new \shop\Producer( $row );
|
||||
|
||||
return \Shared\Tpl\Tpl::view( 'shop-producer/list', [
|
||||
'producers' => $producers
|
||||
] );
|
||||
}
|
||||
}
|
||||
@@ -191,6 +191,12 @@ class Site
|
||||
new \Domain\Order\OrderRepository( $mdb )
|
||||
);
|
||||
},
|
||||
'ShopProducer' => function() {
|
||||
global $mdb;
|
||||
return new \front\Controllers\ShopProducerController(
|
||||
new \Domain\Producer\ProducerRepository( $mdb )
|
||||
);
|
||||
},
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ class Site
|
||||
$pagesRepo = new \Domain\Pages\PagesRepository( $GLOBALS['mdb'] );
|
||||
$scontainersRepo = new \Domain\Scontainers\ScontainersRepository( $GLOBALS['mdb'] );
|
||||
$categoryRepo = new \Domain\Category\CategoryRepository( $GLOBALS['mdb'] );
|
||||
$producerRepo = new \Domain\Producer\ProducerRepository( $GLOBALS['mdb'] );
|
||||
|
||||
if ( (int) \Shared\Helpers\Helpers::get( 'layout_id' ) )
|
||||
$layout = $layoutsRepo->find( (int) \Shared\Helpers\Helpers::get( 'layout_id' ) );
|
||||
@@ -216,9 +217,9 @@ class Site
|
||||
//
|
||||
if ( \Shared\Helpers\Helpers::get( 'producer_id' ) )
|
||||
{
|
||||
$producer = new \shop\Producer( \Shared\Helpers\Helpers::get( 'producer_id' ) );
|
||||
$producer = $producerRepo->findForFrontend( (int)\Shared\Helpers\Helpers::get( 'producer_id' ), $lang_id );
|
||||
|
||||
if ( $producer['languages'][$lang_id]['meta_title'] )
|
||||
if ( $producer && !empty( $producer['languages'][$lang_id]['meta_title'] ) )
|
||||
$page['language']['meta_title'] = $producer['languages'][$lang_id]['meta_title'];
|
||||
}
|
||||
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
<?php
|
||||
namespace shop;
|
||||
class Producer implements \ArrayAccess
|
||||
{
|
||||
public function __construct( int $producer_id )
|
||||
{
|
||||
global $mdb;
|
||||
|
||||
$repo = new \Domain\Producer\ProducerRepository( $mdb );
|
||||
$data = $repo->find( $producer_id );
|
||||
|
||||
foreach ( $data as $key => $val )
|
||||
$this->$key = $val;
|
||||
}
|
||||
|
||||
static public function producer_products( $producer_id, $lang_id, $bs )
|
||||
{
|
||||
global $mdb;
|
||||
|
||||
$repo = new \Domain\Producer\ProducerRepository( $mdb );
|
||||
return $repo->producerProducts( (int) $producer_id, 12, (int) $bs );
|
||||
}
|
||||
|
||||
public function __get( $variable )
|
||||
{
|
||||
if ( array_key_exists( $variable, $this -> data ) )
|
||||
return $this -> $variable;
|
||||
}
|
||||
|
||||
public function __set( $variable, $value )
|
||||
{
|
||||
$this -> $variable = $value;
|
||||
}
|
||||
|
||||
public function offsetExists( $offset )
|
||||
{
|
||||
return isset( $this -> $offset );
|
||||
}
|
||||
|
||||
public function offsetGet( $offset )
|
||||
{
|
||||
return $this -> $offset;
|
||||
}
|
||||
|
||||
public function offsetSet( $offset, $value )
|
||||
{
|
||||
$this -> $offset = $value;
|
||||
}
|
||||
|
||||
public function offsetUnset( $offset )
|
||||
{
|
||||
unset( $this -> $offset );
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,20 @@ Logi zmian z migracji na Domain-Driven Architecture. Najnowsze na gorze.
|
||||
|
||||
---
|
||||
|
||||
## ver. 0.291 (2026-02-17) - ShopProducer frontend migration
|
||||
|
||||
- **ShopProducer (frontend)** — migracja controls + shop facade na Domain + Controllers
|
||||
- NOWA METODA w `ProducerRepository`: `allActiveProducers()` — pełne dane aktywnych producentów (id, name, img)
|
||||
- NOWY: `front\Controllers\ShopProducerController` — instancyjny kontroler z DI (`products()`, `list()`)
|
||||
- USUNIETA: `front\controls\class.ShopProducer.php` — logika przeniesiona do kontrolera + repozytorium
|
||||
- USUNIETA: `autoload\shop\class.Producer.php` — fasada niepotrzebna, callery przepięte na repo
|
||||
- UPDATE: `front\view\Site::show()` — `new \shop\Producer(...)` zamienione na `$producerRepo->findForFrontend()`
|
||||
- UPDATE: `front\controls\Site::getControllerFactories()` — zarejestrowany `'ShopProducer'`
|
||||
- FIX: bug `shop\Producer::__get()` referował nieistniejące `$this->data` (usunięty z kodem klasy)
|
||||
- Testy: 573 OK, 1738 asercji (+8: 5 ProducerRepository frontend, 3 ShopProducerController)
|
||||
|
||||
---
|
||||
|
||||
## ver. 0.290 (2026-02-17) - ShopCoupon + ShopOrder frontend migration
|
||||
|
||||
- **ShopCoupon (frontend)** — migracja controls + factory na Domain + Controllers
|
||||
@@ -761,4 +775,4 @@ Logi zmian z migracji na Domain-Driven Architecture. Najnowsze na gorze.
|
||||
- Metoda `clear_product_cache()` w klasie S
|
||||
|
||||
---
|
||||
*Dokument aktualizowany: 2026-02-17 (ver. 0.289)*
|
||||
*Dokument aktualizowany: 2026-02-17 (ver. 0.291)*
|
||||
|
||||
@@ -619,7 +619,7 @@ Producenci produktow (modul `/admin/shop_producer`).
|
||||
| status | Status: 1 = aktywny, 0 = nieaktywny |
|
||||
| img | Sciezka do logo producenta (NULL gdy brak) |
|
||||
|
||||
**Uzywane w:** `Domain\Producer\ProducerRepository`, `admin\Controllers\ShopProducerController`, `shop\Producer`, `shop\Product`, `front\controls\ShopProducer`
|
||||
**Uzywane w:** `Domain\Producer\ProducerRepository`, `admin\Controllers\ShopProducerController`, `front\Controllers\ShopProducerController`, `shop\Product`
|
||||
|
||||
## pp_shop_producer_lang
|
||||
Tlumaczenia producentow (per jezyk). FK kaskadowe ON DELETE CASCADE.
|
||||
@@ -633,6 +633,8 @@ Tlumaczenia producentow (per jezyk). FK kaskadowe ON DELETE CASCADE.
|
||||
| data | Dane producenta (TEXT, HTML) |
|
||||
| meta_title | Meta title SEO (VARCHAR 255) |
|
||||
|
||||
**Uzywane w:** `Domain\Producer\ProducerRepository`, `shop\Producer`, `shop\Product`
|
||||
**Uzywane w:** `Domain\Producer\ProducerRepository`, `shop\Product`
|
||||
|
||||
**Aktualizacja 2026-02-15 (ver. 0.273):** modul `/admin/shop_producer` korzysta z `Domain\Producer\ProducerRepository` przez `admin\Controllers\ShopProducerController`. Usunieto legacy `admin\controls\ShopProducer` i `admin\factory\ShopProducer`. `shop\Producer` dziala jako fasada do repozytorium.
|
||||
|
||||
**Aktualizacja 2026-02-17 (ver. 0.291):** frontend `/shop_producer/*` korzysta z `Domain\Producer\ProducerRepository` przez `front\Controllers\ShopProducerController`; usunięto legacy `front\controls\ShopProducer` i `shop\Producer`.
|
||||
|
||||
@@ -18,7 +18,7 @@ Panel administratora (33 moduły) został w pełni zmigrowany na architekturę D
|
||||
| ShopClient | ZMIGROWANY do `front\Controllers\ShopClientController` | Logowanie, rejestracja, odzyskiwanie hasla, adresy, zamowienia |
|
||||
| ShopOrder | ZMIGROWANY do `front\Controllers\ShopOrderController` | Webhooki płatności + order details |
|
||||
| ShopProduct | Fasada | lazy_loading, warehouse_message, draw_product_attributes |
|
||||
| ShopProducer | Fasada | list(), products() |
|
||||
| ShopProducer | ZMIGROWANY do `front\Controllers\ShopProducerController` | list(), products() |
|
||||
| ShopCoupon | ZMIGROWANY do `front\Controllers\ShopCouponController` | use_coupon(), delete_coupon() |
|
||||
| Newsletter | ZMIGROWANY do `front\Controllers\NewsletterController` | signin(), confirm(), unsubscribe() |
|
||||
|
||||
@@ -73,7 +73,7 @@ Panel administratora (33 moduły) został w pełni zmigrowany na architekturę D
|
||||
| Coupon | ~60 | NISKI — niekompletne metody | NISKI |
|
||||
| Transport | ~30 | NISKI — transport_list() | NISKI |
|
||||
| PaymentMethod | — | ZMIGROWANA (fasada do Domain) | — |
|
||||
| Producer | — | ZMIGROWANA (fasada do Domain) | — |
|
||||
| Producer | — | USUNIETA (callery na ProducerRepository) | — |
|
||||
| ProductSet | — | ZMIGROWANA (fasada do Domain) | — |
|
||||
| ProductAttribute | ~100 | OK — dobry caching | — |
|
||||
| ProductCustomField | ~50 | OK — Redis caching | — |
|
||||
|
||||
@@ -108,7 +108,7 @@ shopPRO/
|
||||
│ │ ├── Helpers/ # Helpers (ex class.S.php)
|
||||
│ │ └── Tpl/ # Tpl (silnik szablonow)
|
||||
│ ├── front/ # Klasy frontendu
|
||||
│ │ ├── Controllers/ # Nowe kontrolery DI (Newsletter, ShopBasket, ShopClient)
|
||||
│ │ ├── Controllers/ # Nowe kontrolery DI (Newsletter, ShopBasket, ShopClient, ShopCoupon, ShopOrder, ShopProducer)
|
||||
│ │ ├── Views/ # Nowe widoki (Newsletter, Articles, Languages, Banners, Menu, Scontainers, ShopCategory, ShopClient)
|
||||
│ │ ├── controls/ # Kontrolery legacy (Site, ...)
|
||||
│ │ ├── view/ # Widoki legacy (Site, ...)
|
||||
@@ -473,5 +473,13 @@ Pelna dokumentacja testow: `TESTING.md`
|
||||
- UPDATE: `ClientRepository::clientOrders()`, `shop\Order::order_resend_confirmation_email()`, `cron-turstmate.php` — przepiete na `OrderRepository`
|
||||
- USUNIETA: `front\controls\class.ShopOrder.php`, `front\factory\class.ShopOrder.php`, `front\view\class.ShopOrder.php`
|
||||
|
||||
## Aktualizacja 2026-02-17 (ver. 0.291) - ShopProducer frontend migration
|
||||
- NOWA METODA w `ProducerRepository`: `allActiveProducers()` — pełne dane aktywnych producentów
|
||||
- NOWY: `front\Controllers\ShopProducerController` — instancyjny kontroler z DI (products, list)
|
||||
- USUNIETA: `front\controls\class.ShopProducer.php` — logika przeniesiona do kontrolera + repo
|
||||
- USUNIETA: `autoload\shop\class.Producer.php` — fasada niepotrzebna
|
||||
- UPDATE: `front\view\Site::show()` — przepiecie na `$producerRepo->findForFrontend()`
|
||||
- UPDATE: `front\controls\Site::getControllerFactories()` — zarejestrowany `ShopProducer`
|
||||
|
||||
---
|
||||
*Dokument aktualizowany: 2026-02-17 (ver. 0.290)*
|
||||
*Dokument aktualizowany: 2026-02-17 (ver. 0.291)*
|
||||
|
||||
@@ -189,6 +189,7 @@ grep -r "Product::getQuantity" .
|
||||
1-33: ✅ Cache, Product, Banner, Settings, Dictionaries, ProductArchive, Filemanager, Users, Pages, Integrations, ShopPromotion, ShopCoupon, ShopStatuses, ShopPaymentMethod, ShopTransport, ShopAttribute, ShopProductSets, ShopProducer, ShopProduct (mass_edit), ShopClients, ShopCategory, ShopOrder, ShopProduct (factory), Dashboard, Update, Legacy cleanup, admin\App
|
||||
34: ✅ Shared\Cache namespace (ver. 0.282) — CacheHandler + RedisConnection → Shared\Cache\, eliminacja class.Cache.php, przepiecie 6 plikow na CacheHandler
|
||||
35: ✅ Shared\Tpl namespace (ver. 0.285) — Tpl → Shared\Tpl\Tpl, eliminacja class.Tpl.php + curl.class.php, fix thumb.php
|
||||
36: ✅ ShopProducer frontend (ver. 0.291) — front\controls\ShopProducer + shop\Producer usunięte, front\Controllers\ShopProducerController z DI, allActiveProducers() w ProducerRepository
|
||||
|
||||
## Form Edit System
|
||||
|
||||
|
||||
@@ -36,7 +36,14 @@ Alternatywnie (Git Bash):
|
||||
Ostatnio zweryfikowano: 2026-02-17
|
||||
|
||||
```text
|
||||
OK (565 tests, 1716 assertions)
|
||||
OK (573 tests, 1738 assertions)
|
||||
```
|
||||
|
||||
Aktualizacja po migracji ShopProducer frontend (2026-02-17, ver. 0.291):
|
||||
```text
|
||||
Pelny suite: OK (573 tests, 1738 assertions)
|
||||
Nowe testy: ProducerRepositoryTest (+5: allActiveProducers full/null, findForFrontend invalid/notFound/withLanguage)
|
||||
Nowe testy: ShopProducerControllerTest (+3: constructorAcceptsRepository, hasMainActionMethods, constructorRequiresProducerRepository)
|
||||
```
|
||||
|
||||
Aktualizacja po migracji ShopCoupon + ShopOrder frontend (2026-02-17, ver. 0.290):
|
||||
|
||||
@@ -18,16 +18,16 @@ Aktualizacje znajdują się w folderze `updates/0.XX/` gdzie XX oznacza dziesią
|
||||
|
||||
## Procedura tworzenia nowej aktualizacji
|
||||
|
||||
## Status biezacej aktualizacji (ver. 0.290)
|
||||
## Status biezacej aktualizacji (ver. 0.291)
|
||||
|
||||
- Wersja udostepniona: `0.290` (data: 2026-02-17).
|
||||
- Wersja udostepniona: `0.291` (data: 2026-02-17).
|
||||
- Pliki publikacyjne:
|
||||
- `updates/0.20/ver_0.290.zip`, `ver_0.290_files.txt`
|
||||
- `updates/0.20/ver_0.291.zip`, `ver_0.291_files.txt`
|
||||
- Pliki metadanych aktualizacji:
|
||||
- `updates/changelog.php` (dodany wpis `ver. 0.290`)
|
||||
- `updates/versions.php` (`$current_ver = 290`)
|
||||
- `updates/changelog.php` (dodany wpis `ver. 0.291`)
|
||||
- `updates/versions.php` (`$current_ver = 291`)
|
||||
- Weryfikacja testow przed publikacja:
|
||||
- `OK (565 tests, 1716 assertions)`
|
||||
- `OK (573 tests, 1738 assertions)`
|
||||
|
||||
### 1. Określ numer wersji
|
||||
Sprawdź ostatnią wersję w `updates/` i zwiększ o 1.
|
||||
|
||||
@@ -237,4 +237,79 @@ class ProducerRepositoryTest extends TestCase
|
||||
$this->assertArrayHasKey('ls', $result);
|
||||
$this->assertSame(3, $result['ls']);
|
||||
}
|
||||
|
||||
public function testAllActiveProducersReturnsFullData(): void
|
||||
{
|
||||
$mockDb = $this->createMock(\medoo::class);
|
||||
$mockDb->expects($this->once())
|
||||
->method('select')
|
||||
->with('pp_shop_producer', ['id', 'name', 'img'], [
|
||||
'status' => 1,
|
||||
'ORDER' => ['name' => 'ASC'],
|
||||
])
|
||||
->willReturn([
|
||||
['id' => '3', 'name' => 'Apple', 'img' => '/apple.png'],
|
||||
['id' => '7', 'name' => 'Samsung', 'img' => null],
|
||||
]);
|
||||
|
||||
$repository = new ProducerRepository($mockDb);
|
||||
$result = $repository->allActiveProducers();
|
||||
|
||||
$this->assertCount(2, $result);
|
||||
$this->assertSame(3, $result[0]['id']);
|
||||
$this->assertSame('Apple', $result[0]['name']);
|
||||
$this->assertSame('/apple.png', $result[0]['img']);
|
||||
$this->assertSame(7, $result[1]['id']);
|
||||
$this->assertSame('Samsung', $result[1]['name']);
|
||||
$this->assertNull($result[1]['img']);
|
||||
}
|
||||
|
||||
public function testAllActiveProducersReturnsEmptyOnNull(): void
|
||||
{
|
||||
$mockDb = $this->createMock(\medoo::class);
|
||||
$mockDb->method('select')->willReturn(null);
|
||||
|
||||
$repository = new ProducerRepository($mockDb);
|
||||
$result = $repository->allActiveProducers();
|
||||
|
||||
$this->assertSame([], $result);
|
||||
}
|
||||
|
||||
public function testFindForFrontendReturnsNullForInvalidId(): void
|
||||
{
|
||||
$mockDb = $this->createMock(\medoo::class);
|
||||
$mockDb->expects($this->never())->method('get');
|
||||
|
||||
$repository = new ProducerRepository($mockDb);
|
||||
$this->assertNull($repository->findForFrontend(0, 'pl'));
|
||||
}
|
||||
|
||||
public function testFindForFrontendReturnsNullWhenNotFound(): void
|
||||
{
|
||||
$mockDb = $this->createMock(\medoo::class);
|
||||
$mockDb->method('get')->willReturn(null);
|
||||
|
||||
$repository = new ProducerRepository($mockDb);
|
||||
$this->assertNull($repository->findForFrontend(99, 'pl'));
|
||||
}
|
||||
|
||||
public function testFindForFrontendReturnsProducerWithLanguage(): void
|
||||
{
|
||||
$mockDb = $this->createMock(\medoo::class);
|
||||
|
||||
$mockDb->expects($this->exactly(2))
|
||||
->method('get')
|
||||
->willReturnOnConsecutiveCalls(
|
||||
['id' => '5', 'name' => 'Sony', 'status' => '1', 'img' => '/sony.png'],
|
||||
['lang_id' => 'pl', 'description' => 'Opis', 'data' => null, 'meta_title' => 'Sony PL']
|
||||
);
|
||||
|
||||
$repository = new ProducerRepository($mockDb);
|
||||
$result = $repository->findForFrontend(5, 'pl');
|
||||
|
||||
$this->assertSame(5, $result['id']);
|
||||
$this->assertSame('Sony', $result['name']);
|
||||
$this->assertArrayHasKey('pl', $result['languages']);
|
||||
$this->assertSame('Sony PL', $result['languages']['pl']['meta_title']);
|
||||
}
|
||||
}
|
||||
|
||||
40
tests/Unit/front/Controllers/ShopProducerControllerTest.php
Normal file
40
tests/Unit/front/Controllers/ShopProducerControllerTest.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
namespace Tests\Unit\front\Controllers;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use front\Controllers\ShopProducerController;
|
||||
use Domain\Producer\ProducerRepository;
|
||||
|
||||
class ShopProducerControllerTest extends TestCase
|
||||
{
|
||||
private $repository;
|
||||
private $controller;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->repository = $this->createMock(ProducerRepository::class);
|
||||
$this->controller = new ShopProducerController($this->repository);
|
||||
}
|
||||
|
||||
public function testConstructorAcceptsRepository(): void
|
||||
{
|
||||
$controller = new ShopProducerController($this->repository);
|
||||
$this->assertInstanceOf(ShopProducerController::class, $controller);
|
||||
}
|
||||
|
||||
public function testHasMainActionMethods(): void
|
||||
{
|
||||
$this->assertTrue(method_exists($this->controller, 'products'));
|
||||
$this->assertTrue(method_exists($this->controller, 'list'));
|
||||
}
|
||||
|
||||
public function testConstructorRequiresProducerRepository(): void
|
||||
{
|
||||
$reflection = new \ReflectionClass(ShopProducerController::class);
|
||||
$constructor = $reflection->getConstructor();
|
||||
$params = $constructor->getParameters();
|
||||
|
||||
$this->assertCount(1, $params);
|
||||
$this->assertEquals('Domain\Producer\ProducerRepository', $params[0]->getType()->getName());
|
||||
}
|
||||
}
|
||||
BIN
updates/0.20/ver_0.291.zip
Normal file
BIN
updates/0.20/ver_0.291.zip
Normal file
Binary file not shown.
2
updates/0.20/ver_0.291_files.txt
Normal file
2
updates/0.20/ver_0.291_files.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
F: ../autoload/front/controls/class.ShopProducer.php
|
||||
F: ../autoload/shop/class.Producer.php
|
||||
@@ -1,3 +1,7 @@
|
||||
<b>ver. 0.291 - 17.02.2026</b><br />
|
||||
- UPDATE - migracja front\controls\ShopProducer + shop\Producer do Domain\Producer\ProducerRepository + front\Controllers\ShopProducerController
|
||||
- FIX - bug shop\Producer::__get() referowal nieistniejace $this->data
|
||||
<hr>
|
||||
<b>ver. 0.290 - 17.02.2026</b><br />
|
||||
- UPDATE - migracja front\factory\ShopCoupon + front\controls\ShopCoupon do Domain\Coupon\CouponRepository + front\Controllers\ShopCouponController
|
||||
- UPDATE - migracja front\factory\ShopOrder + front\controls\ShopOrder + front\view\ShopOrder do Domain\Order\OrderRepository + front\Controllers\ShopOrderController
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?
|
||||
$current_ver = 290;
|
||||
$current_ver = 291;
|
||||
|
||||
for ($i = 1; $i <= $current_ver; $i++)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user