eq() public static method

public static eq ( $value, $value2, $message = '' )
Example #1
0
 /**
  * 测试用户不存在
  */
 function testUserNotExists()
 {
     $api = $this->createApi($this->url)->setQuery(['email' => '*****@*****.**', 'password' => '123456'])->setVerify($this->getMechanic()->getAssetPath() . DIRECTORY_SEPARATOR . 'cacert.pem');
     $response = $this->request($api);
     $responseData = json_decode($response->getBody());
     Assert::eq($response->getStatusCode(), 200, '服务器连接错误');
     Assert::eq($responseData->code, 104, '状态码返回错误');
 }
 /**
  * {@inheritdoc}
  */
 public function apply(OrderInterface $order, PromotionInterface $promotion, array $adjustmentsAmounts)
 {
     Assert::eq($order->countItems(), count($adjustmentsAmounts));
     $i = 0;
     foreach ($order->getItems() as $item) {
         $adjustmentAmount = $adjustmentsAmounts[$i++];
         if (0 === $adjustmentAmount) {
             continue;
         }
         $this->applyAdjustmentsOnItemUnits($item, $promotion, $adjustmentAmount);
     }
 }
 /**
  * @Then there is a/an :class document at :path
  * @Then there is a/an :class document at :path:
  */
 public function thereIsADocumentAt($class, $path, TableNode $fields = null)
 {
     $class = 'Symfony\\Cmf\\Bundle\\ResourceRestBundle\\Tests\\Resources\\TestBundle\\Document\\' . $class;
     $path = '/tests' . $path;
     if (!class_exists($class)) {
         throw new \InvalidArgumentException(sprintf('Class "%s" does not exist', $class));
     }
     $document = $this->manager->find($class, $path);
     Assert::notNull($document, sprintf('No "%s" document exists at "%s"', $class, $path));
     if (null === $fields) {
         return;
     }
     foreach ($fields->getRowsHash() as $field => $value) {
         Assert::eq($document->{$field}, $value);
     }
 }
Example #4
0
 /**
  * @Then /^there should be(?:| only) (\d+) payments?$/
  */
 public function theOrderShouldHaveNumberOfPayments($number)
 {
     $actualNumberOfPayments = $this->showPage->getPaymentsCount();
     Assert::eq($number, $actualNumberOfPayments);
 }
 /**
  * @Then I should see the taxon named :name in the list
  */
 public function iShouldSeeTheTaxonNamedInTheList($name)
 {
     Assert::eq(1, $this->createPage->countTaxonsByName($name), sprintf('Taxon %s does not exist or multiple taxons with this name exist.', $name));
 }
Example #6
0
 /**
  * @Then :count email(s) should be sent to :recipient
  */
 public function numberOfEmailsShouldBeSentTo($count, $recipient)
 {
     $actualMessagesCount = $this->emailChecker->countMessagesTo($recipient);
     Assert::eq($actualMessagesCount, $count, sprintf('%d messages were sent, while there should be %d.', $actualMessagesCount, $count));
 }
 /**
  * @Then /^there should be no units of (this product) on hold$/
  */
 public function thereShouldBeNoUnitsOfThisProductOnHold(ProductInterface $product)
 {
     Assert::eq(0, $this->indexPage->getOnHoldQuantityFor($product->getFirstVariant()), sprintf('Unexpected on hand quantity for "%s" variant. It should be "%s" but is "%s"', $product->getFirstVariant()->getName(), 0, $this->indexPage->getOnHandQuantityFor($product->getFirstVariant())));
 }
Example #8
0
 /**
  * @Transform /^"([^"]+)" product variant$/
  * @Transform /^"([^"]+)" variant$/
  * @Transform :variant
  */
 public function getProductVariantByName($name)
 {
     $productVariants = $this->productVariantRepository->findBy(['name' => $name]);
     Assert::eq(1, count($productVariants), sprintf('%d product variants has been found with name "%s".', count($productVariants), $name));
     return $productVariants[0];
 }
 /**
  * @Then /^I should see (\d+) product options in the list$/
  */
 public function iShouldSeeProductOptionsInTheList($amount)
 {
     $foundRows = $this->indexPage->countItems();
     Assert::eq($amount, $foundRows, '%2$s rows with product options should appear on page, %s rows has been found');
 }
 /**
  * @Then /^there should be (\d+) coupon related to (this promotion)$/
  */
 public function thereShouldBeCouponRelatedTo($number, PromotionInterface $promotion)
 {
     $this->indexPage->open(['promotionId' => $promotion->getId()]);
     Assert::eq($number, $this->indexPage->countItems(), 'There should be %s coupons but is %s');
 }
 /**
  * @Then /^there should be (\d+) promotion(?:|s)$/
  */
 public function thereShouldBePromotion($number)
 {
     Assert::eq($number, $this->indexPage->countItems(), 'I should see %s promotions but i see only %2$s');
 }
Example #12
0
 /**
  * @param string $taxCategoryName
  *
  * @return TaxCategoryInterface
  */
 private function getOrCreateTaxCategory($taxCategoryName)
 {
     $taxCategories = $this->taxCategoryRepository->findByName($taxCategoryName);
     if (empty($taxCategories)) {
         return $this->createTaxCategory($taxCategoryName);
     }
     Assert::eq(1, count($taxCategories), sprintf('%d tax categories has been found with name "%s".', count($taxCategories), $taxCategoryName));
     return $taxCategories[0];
 }
 /**
  * @Then /^(this customer) should be disabled$/
  */
 public function thisCustomerShouldBeDisabled(CustomerInterface $customer)
 {
     $this->indexPage->open();
     Assert::eq('No', $this->indexPage->getCustomerAccountStatus($customer), 'Customer account should be disabled, but it does not.');
 }
 /**
  * @Then I should see :amount payment methods in the list
  */
 public function iShouldSeePaymentMethodsInTheList($amount)
 {
     $foundRows = $this->indexPage->countItems();
     Assert::eq((int) $amount, $foundRows, '%2$s rows with payment methods should appear on page, %s rows has been found');
 }
 /**
  * @Then it should have a ratio of :ratio
  */
 public function thisExchangeRateShouldHaveRatioOf($ratio)
 {
     Assert::eq($ratio, $this->updatePage->getRatio(), 'Exchange rate\'s ratio should be %s, but is %s instead.');
 }
 /**
  * @Then this taxon should not have images
  */
 public function thisTaxonShouldNotHaveImages()
 {
     Assert::eq(0, $this->updatePage->countImages(), 'This taxon has %2$s, but it should not have.');
 }
 /**
  * @Then I should see :numberOfChannels channels in the list
  */
 public function iShouldSeeChannelsInTheList($numberOfChannels)
 {
     $foundRows = $this->indexPage->countItems();
     Assert::eq((int) $numberOfChannels, $foundRows, sprintf('%s rows with channels should appear on page, %s rows has been found', $numberOfChannels, $foundRows));
 }
 /**
  * @Then I should see :numberOfProducts products in the list
  */
 public function iShouldSeeProductsInTheList($numberOfProducts)
 {
     $foundRows = $this->indexPage->countItems();
     Assert::eq($numberOfProducts, $foundRows, '%s rows with products should appear on page, %s rows has been found');
 }
Example #19
0
 /**
  * @Then /^(this zone) should have only (the "([^"]*)" (?:country|province|zone) member)$/
  */
 public function thisZoneShouldHaveOnlyTheProvinceMember(ZoneInterface $zone, ZoneMemberInterface $zoneMember)
 {
     $this->assertZoneAndItsMember($zone, $zoneMember);
     Assert::eq(1, $this->updatePage->countMembers(), sprintf('Zone %s should have only %s zone member', $zone->getName(), $zoneMember->getCode()));
 }
Example #20
0
 /**
  * @Then /^(its) total should be ([^"]+)$/
  */
 public function itemTotalShouldBe($itemName, $total)
 {
     $itemTotalOnPage = $this->showPage->getItemTotal($itemName);
     Assert::eq($itemTotalOnPage, $total, 'Item total is %s, but should be %s.');
 }
 /**
  * @Then there should still be only one image in the :taxon taxon
  */
 public function thereShouldStillBeOnlyOneImageInThisTaxon(TaxonInterface $taxon)
 {
     $this->iWantToModifyATaxon($taxon);
     Assert::eq(1, $this->updatePage->countImages(), 'This taxon has %2$s images, but it should have only one.');
 }
 /**
  * @Given he should be registered since :registrationDate
  */
 public function hisRegistrationDateShouldBe($registrationDate)
 {
     Assert::eq(new \DateTime($registrationDate), $this->showPage->getRegistrationDate(), 'Customer registration date should be "%s", but it is not.');
 }
 /**
  * @Then /^I should see (\d+) zones in the list$/
  */
 public function iShouldSeeZonesInTheList($number)
 {
     $resourcesOnPage = $this->indexPage->countItems();
     Assert::eq($number, $resourcesOnPage, sprintf('On list should be %d zones but get %d', $number, $resourcesOnPage));
 }
 /**
  * @Then /^(this currency) should still have exchange rate equal to ([0-9\.]+)$/
  */
 public function theCurrencyShouldStillHaveExchangeRateEquals(CurrencyInterface $currency, $exchangeRate)
 {
     $this->updatePage->open(['id' => $currency->getId()]);
     Assert::eq($exchangeRate, $this->updatePage->getExchangeRateValue(), sprintf('Currency exchange rate should be equal %s, but was %s.', $exchangeRate, $this->updatePage->getExchangeRateValue()));
 }
Example #25
0
 /**
  * @Then the first order should have number :number
  */
 public function theFirstOrderShouldHaveNumber($number)
 {
     $actualNumber = $this->indexPage->getColumnFields('number')[0];
     Assert::eq($actualNumber, $number, sprintf('Expected first order\'s number to be %s, but it is %s.', $number, $actualNumber));
 }
Example #26
0
 /**
  * @Then I should see that I have to pay :paymentAmount for this order
  */
 public function iShouldSeeIHaveToPayForThisOrder($paymentAmount)
 {
     $actualAmount = $this->orderShowPage->getPaymentPrice();
     Assert::eq($paymentAmount, $actualAmount);
 }
Example #27
0
 /**
  * @Then the subtotal of :item item should be :price
  */
 public function theSubtotalOfItemShouldBe($item, $price)
 {
     $currentPage = $this->resolveCurrentStepPage();
     $actualPrice = $currentPage->getItemSubtotal($item);
     Assert::eq($actualPrice, $price, sprintf('The %s subtotal should be %s, but is %s', $item, $price, $actualPrice));
 }
Example #28
0
 /**
  * @Transform /^product(?:|s) "([^"]+)"$/
  * @Transform /^"([^"]+)" product(?:|s)$/
  * @Transform /^(?:a|an) "([^"]+)"$/
  * @Transform :product
  * @Transform /^"[^"]+" product$/
  */
 public function getProductByName($productName)
 {
     $products = $this->productRepository->findByName($productName, 'en_US');
     Assert::eq(1, count($products), sprintf('%d products has been found with name "%s".', count($products), $productName));
     return $products[0];
 }
Example #29
0
 /**
  * @Transform /^"([^"]+)" shipping method$/
  * @Transform /^shipping method "([^"]+)"$/
  * @Transform :shippingMethod
  */
 public function getShippingMethodByName($shippingMethodName)
 {
     $shippingMethods = $this->shippingMethodRepository->findByName($shippingMethodName, 'en_US');
     Assert::eq(1, count($shippingMethods), sprintf('%d shipping methods have been found with name "%s".', count($shippingMethods), $shippingMethodName));
     return $shippingMethods[0];
 }
 /**
  * @Then :count email(s) should be sent to :email
  */
 public function numberOfEmailsShouldBeSentTo($count, $email)
 {
     Assert::true($this->emailChecker->hasRecipient($email), sprintf('At least 1 email should have been sent to %s.', $email));
     Assert::eq($this->emailChecker->getMessagesCount(), $count, sprintf('%d messages were sent, while there should be %d.', $this->emailChecker->getMessagesCount(), $count));
 }