コード例 #1
0
ファイル: TestPromotionFactory.php プロジェクト: sylius/core
 /**
  * {@inheritdoc}
  */
 public function create($name)
 {
     $promotion = $this->promotionFactory->createNew();
     $promotion->setName($name);
     $promotion->setCode(StringInflector::nameToLowercaseCode($name));
     $promotion->setStartsAt(new \DateTime('-3 days'));
     $promotion->setEndsAt(new \DateTime('+3 days'));
     return $promotion;
 }
コード例 #2
0
ファイル: CheckoutContext.php プロジェクト: starspire/Sylius
 /**
  * @Then my order's billing address should be to :fullName
  */
 public function iShouldSeeThisBillingAddressAsBillingAddress($fullName)
 {
     $address = $this->sharedStorage->get('billing_address_' . StringInflector::nameToLowercaseCode($fullName));
     Assert::true($this->completePage->hasBillingAddress($address), 'Billing address is improper.');
 }
コード例 #3
0
ファイル: TaxationContext.php プロジェクト: okwinza/Sylius
 /**
  * @param string $taxRateName
  *
  * @return string
  */
 private function getCodeFromName($taxRateName)
 {
     return StringInflector::nameToLowercaseCode($taxRateName);
 }
コード例 #4
0
ファイル: ShippingContext.php プロジェクト: Niiko/Sylius
 /**
  * @param string $shippingMethodName
  * @param string|null $zoneCode
  *
  * @return string
  */
 private function generateCodeFromNameAndZone($shippingMethodName, $zoneCode = null)
 {
     return StringInflector::nameToLowercaseCode($shippingMethodName) . '_' . StringInflector::nameToLowercaseCode($zoneCode);
 }
コード例 #5
0
ファイル: CoreContext.php プロジェクト: okwinza/Sylius
 /**
  * @Given /^the following shipping methods are configured:$/
  * @Given /^the following shipping methods exist:$/
  * @Given /^there are shipping methods:$/
  */
 public function thereAreShippingMethods(TableNode $table)
 {
     foreach ($table->getHash() as $data) {
         $calculator = array_key_exists('calculator', $data) ? StringInflector::nameToLowercaseCode($data['calculator']) : DefaultCalculators::PER_UNIT_RATE;
         $configuration = array_key_exists('configuration', $data) ? $this->getConfiguration($data['configuration']) : null;
         $taxCategory = isset($data['tax category']) ? $this->findOneByName('tax_category', trim($data['tax category'])) : null;
         if (!isset($data['enabled'])) {
             $data['enabled'] = 'yes';
         }
         $this->thereIsShippingMethod($data['name'], $data['code'], $data['zone'], $calculator, $taxCategory, $configuration, 'yes' === $data['enabled'], false);
     }
     $this->getEntityManager()->flush();
 }