ArticleTestEnv.php 798 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. namespace pgc\test;
  3. use n2n\test\TestEnv;
  4. use pgc\sub\setting\bo\SubCountry;
  5. use pgc\sub\setting\bo\SubCurrency;
  6. use pgc\sub\plan\bo\SubPlatform;
  7. class ArticleTestEnv {
  8. static function setUpArticle(string $id): Article {
  9. $subPlatform = new SubPlatform($id);
  10. $subPlatform->setOrderIndex(0);
  11. $subPlatform->setOnline(true);
  12. TestEnv::em()->persist($subPlatform);
  13. return $subPlatform;
  14. }
  15. static function setUpSubCurrency(string $code): SubCurrency {
  16. $currency = new SubCurrency();
  17. $currency->setCode($code);
  18. TestEnv::tem()->persist($currency);
  19. return $currency;
  20. }
  21. static function setUpSubCountry(string $code, SubCurrency $subCurrency): SubCountry {
  22. $country = new SubCountry($code, $subCurrency);
  23. TestEnv::tem()->persist($country);
  24. return $country;
  25. }
  26. }