当前位置: 首页>>代码示例>>PHP>>正文


PHP PHPUnit_Framework_Assert::assertEquals方法代码示例

本文整理汇总了PHP中PHPUnit_Framework_Assert::assertEquals方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPUnit_Framework_Assert::assertEquals方法的具体用法?PHP PHPUnit_Framework_Assert::assertEquals怎么用?PHP PHPUnit_Framework_Assert::assertEquals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PHPUnit_Framework_Assert的用法示例。


在下文中一共展示了PHPUnit_Framework_Assert::assertEquals方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: processAssert

 /**
  * Verify incorrect credentials message while login to admin
  *
  * @param AdminAuthLogin $adminAuth
  * @param User $customAdmin
  * @return void
  */
 public function processAssert(AdminAuthLogin $adminAuth, User $customAdmin)
 {
     $adminAuth->open();
     $adminAuth->getLoginBlock()->fill($customAdmin);
     $adminAuth->getLoginBlock()->submit();
     \PHPUnit_Framework_Assert::assertEquals(self::INVALID_CREDENTIALS_MESSAGE, $adminAuth->getMessagesBlock()->getErrorMessages(), 'Message "' . self::INVALID_CREDENTIALS_MESSAGE . '" is not visible.');
 }
开发者ID:aiesh,项目名称:magento2,代码行数:14,代码来源:AssertUserWrongCredentialsMessage.php

示例2: processAssert

 /**
  * Assert that after deleting product success message.
  *
  * @param FixtureInterface|FixtureInterface[] $product
  * @param CatalogProductIndex $productPage
  * @return void
  */
 public function processAssert($product, CatalogProductIndex $productPage)
 {
     $products = is_array($product) ? $product : [$product];
     $deleteMessage = sprintf(self::SUCCESS_DELETE_MESSAGE, count($products));
     $actualMessage = $productPage->getMessagesBlock()->getSuccessMessage();
     \PHPUnit_Framework_Assert::assertEquals($deleteMessage, $actualMessage, 'Wrong success message is displayed.' . "\nExpected: " . $deleteMessage . "\nActual: " . $actualMessage);
 }
开发者ID:andrewhowdencom,项目名称:m2onk8s,代码行数:14,代码来源:AssertProductSuccessDeleteMessage.php

示例3: processAssert

 /**
  * Assert that you will be redirected to url from dataset
  *
  * @param CmsIndex $cmsIndex
  * @param BrowserInterface $browser
  * @param CatalogSearchQuery $searchTerm
  * @return void
  */
 public function processAssert(CmsIndex $cmsIndex, BrowserInterface $browser, CatalogSearchQuery $searchTerm)
 {
     $cmsIndex->open()->getSearchBlock()->search($searchTerm->getSynonymFor());
     $windowUrl = $browser->getUrl();
     $redirectUrl = $searchTerm->getRedirect();
     \PHPUnit_Framework_Assert::assertEquals($windowUrl, $redirectUrl, 'Redirect by synonym was not executed.' . PHP_EOL . "Expected: " . $redirectUrl . PHP_EOL . "Actual: " . $windowUrl);
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:15,代码来源:AssertSearchTermSynonymOnFrontend.php

示例4: theImageAtIndexIs

 /**
  * @Given /^the image at index (\d+) "([^"]*)" is "([^"]*)"$/
  */
 public function theImageAtIndexIs($componentIndex, $componentKey, $componentValue)
 {
     $component = self::$appleNewsObject->components[$componentIndex];
     Assert::assertEquals('photo', $component->components[0]->role);
     Assert::assertTrue(isset($component->components[0]->caption));
     Assert::assertEquals($componentValue, $component->components[0]->caption);
 }
开发者ID:shortlist-digital,项目名称:agreable-apple-news-plugin,代码行数:10,代码来源:ComponentsContext.php

示例5: processAssert

 /**
  * Assert that prices on order review and customer order pages are equal to specified in dataset.
  *
  * @param array $prices
  * @param InjectableFixture $product
  * @param CheckoutCart $checkoutCart
  * @param CheckoutOnepage $checkoutOnepage
  * @param CheckoutOnepageSuccess $checkoutOnepageSuccess
  * @param CustomerOrderView $customerOrderView
  * @return void
  */
 public function processAssert(array $prices, InjectableFixture $product, CheckoutCart $checkoutCart, CheckoutOnepage $checkoutOnepage, CheckoutOnepageSuccess $checkoutOnepageSuccess, CustomerOrderView $customerOrderView)
 {
     $this->checkoutOnepage = $checkoutOnepage;
     $this->customerOrderView = $customerOrderView;
     $checkoutCart->getProceedToCheckoutBlock()->proceedToCheckout();
     $checkoutOnepage->getBillingBlock()->clickContinue();
     $checkoutOnepage->getPaymentMethodsBlock()->selectPaymentMethod(['method' => 'check_money_order']);
     $checkoutOnepage->getPaymentMethodsBlock()->clickContinue();
     $actualPrices = [];
     $actualPrices = $this->getReviewPrices($actualPrices, $product);
     $actualPrices = $this->getReviewTotals($actualPrices);
     $prices = $this->preparePrices($prices);
     //Order review prices verification
     $message = 'Prices on order review should be equal to defined in dataset.';
     \PHPUnit_Framework_Assert::assertEquals($prices, $actualPrices, $message);
     $checkoutOnepage->getReviewBlock()->placeOrder();
     $checkoutOnepageSuccess->getSuccessBlock()->getGuestOrderId();
     $checkoutOnepageSuccess->getSuccessBlock()->openOrder();
     $actualPrices = [];
     $actualPrices = $this->getOrderPrices($actualPrices, $product);
     $actualPrices = $this->getOrderTotals($actualPrices);
     //Frontend order prices verification
     $message = 'Prices on order view page should be equal to defined in dataset.';
     \PHPUnit_Framework_Assert::assertEquals($prices, $actualPrices, $message);
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:36,代码来源:AbstractAssertTaxCalculationAfterCheckoutDownloadable.php

示例6: testDecodeDestinationInstruction

 public function testDecodeDestinationInstruction()
 {
     $decoder = new Decoder();
     $result = $decoder->decodeInstruction('53574150424f540000c56cb39f9b289c0ec4ef6943fa107c904820fe0980df2772');
     $expected = ['operation' => 'destination', 'address' => '1JztLWos5K7LsqW5E78EASgiVBaCe6f7cD'];
     PHPUnit::assertEquals($expected, $result);
 }
开发者ID:tokenly,项目名称:swapbot-op-return,代码行数:7,代码来源:DestinationInstructionTest.php

示例7: testExecuteJobSuccess

 public function testExecuteJobSuccess()
 {
     $configuration = array('test' => true);
     $this->entityManager->expects($this->once())->method('beginTransaction');
     $this->entityManager->expects($this->never())->method('rollback');
     $this->entityManager->expects($this->once())->method('commit');
     $this->batchJobManager->expects($this->at(0))->method('persist')->with($this->isInstanceOf('Akeneo\\Bundle\\BatchBundle\\Entity\\JobInstance'));
     $this->batchJobManager->expects($this->at(1))->method('persist')->with($this->isInstanceOf('Akeneo\\Bundle\\BatchBundle\\Entity\\JobExecution'));
     $this->batchJobManager->expects($this->at(2))->method('flush')->with($this->isInstanceOf('Akeneo\\Bundle\\BatchBundle\\Entity\\JobInstance'));
     $this->batchJobManager->expects($this->at(3))->method('flush')->with($this->isInstanceOf('Akeneo\\Bundle\\BatchBundle\\Entity\\JobExecution'));
     $context = $this->getMockBuilder('Oro\\Bundle\\ImportExportBundle\\Context\\ContextInterface')->getMockForAbstractClass();
     $stepExecution = $this->getMockBuilder('Akeneo\\Bundle\\BatchBundle\\Entity\\StepExecution')->disableOriginalConstructor()->getMock();
     $stepExecution->expects($this->any())->method('getFailureExceptions')->will($this->returnValue(array()));
     $this->contextRegistry->expects($this->once())->method('getByStepExecution')->with($stepExecution)->will($this->returnValue($context));
     $job = $this->getMockBuilder('Akeneo\\Bundle\\BatchBundle\\Job\\JobInterface')->getMock();
     $job->expects($this->once())->method('execute')->with($this->isInstanceOf('Akeneo\\Bundle\\BatchBundle\\Entity\\JobExecution'))->will($this->returnCallback(function (JobExecution $jobExecution) use($configuration, $stepExecution) {
         \PHPUnit_Framework_Assert::assertEquals('import.test', $jobExecution->getJobInstance()->getLabel());
         \PHPUnit_Framework_Assert::assertEquals($configuration, $jobExecution->getJobInstance()->getRawConfiguration());
         $jobExecution->setStatus(new BatchStatus(BatchStatus::COMPLETED));
         $jobExecution->addStepExecution($stepExecution);
     }));
     $this->batchJobRegistry->expects($this->once())->method('getJob')->with($this->isInstanceOf('Akeneo\\Bundle\\BatchBundle\\Entity\\JobInstance'))->will($this->returnValue($job));
     $result = $this->executor->executeJob('import', 'test', $configuration);
     $this->assertInstanceOf('Oro\\Bundle\\ImportExportBundle\\Job\\JobResult', $result);
     $this->assertTrue($result->isSuccessful());
     $this->assertEquals($context, $result->getContext());
 }
开发者ID:xamin123,项目名称:platform,代码行数:27,代码来源:JobExecutorTest.php

示例8: processAssert

 /**
  * Assert that after save a search term on edit term search page displays:
  *  - correct Search Query field passed from fixture
  *  - correct Store
  *  - correct Number of results
  *  - correct Number of Uses
  *  - correct Synonym For
  *  - correct Redirect URL
  *  - correct Display in Suggested Terms
  *
  * @param CatalogSearchIndex $indexPage
  * @param CatalogSearchEdit $editPage
  * @param CatalogSearchQuery $searchTerm
  * @return void
  */
 public function processAssert(CatalogSearchIndex $indexPage, CatalogSearchEdit $editPage, CatalogSearchQuery $searchTerm)
 {
     $indexPage->open()->getGrid()->searchAndOpen(['search_query' => $searchTerm->getQueryText()]);
     $formData = $editPage->getForm()->getData($searchTerm);
     $fixtureData = $searchTerm->getData();
     \PHPUnit_Framework_Assert::assertEquals($formData, $fixtureData, 'This form "Search Term" does not match the fixture data.');
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:22,代码来源:AssertSearchTermForm.php

示例9: testPruneOldTransactions

 public function testPruneOldTransactions()
 {
     $tx_helper = app('SampleTransactionsHelper');
     $created_txs = [];
     for ($i = 0; $i < 5; $i++) {
         $created_txs[] = $tx_helper->createSampleTransaction('sample_xcp_parsed_01.json', ['txid' => str_repeat('0', 63) . ($i + 1)]);
     }
     $tx_repository = app('App\\Repositories\\TransactionRepository');
     $created_txs[0]->timestamps = false;
     $tx_repository->update($created_txs[0], ['updated_at' => time() - 60], ['timestamps' => false]);
     $created_txs[1]->timestamps = false;
     $tx_repository->update($created_txs[1], ['updated_at' => time() - 59], ['timestamps' => false]);
     $created_txs[2]->timestamps = false;
     $tx_repository->update($created_txs[2], ['updated_at' => time() - 5], ['timestamps' => false]);
     // prune all
     $this->dispatch(new PruneTransactions(50));
     // check that all transactions were erased
     $tx_repository = app('App\\Repositories\\TransactionRepository');
     foreach ($created_txs as $offset => $created_tx) {
         $loaded_tx = $tx_repository->findByTXID($created_tx['txid']);
         if ($offset < 2) {
             PHPUnit::assertNull($loaded_tx, "found unexpected tx: " . ($loaded_tx ? json_encode($loaded_tx->toArray(), 192) : 'null'));
         } else {
             PHPUnit::assertNotNull($loaded_tx, "missing tx {$offset}");
             PHPUnit::assertEquals($created_tx->toArray(), $loaded_tx->toArray());
         }
     }
 }
开发者ID:CryptArc,项目名称:xchain,代码行数:28,代码来源:PruneTransactionsTest.php

示例10: processAssert

 /**
  * Assert that after mass update successful message appears.
  *
  * @param CatalogProductIndex $productGrid
  * @param array $products
  * @return void
  */
 public function processAssert(CatalogProductIndex $productGrid, $products = [])
 {
     $countProducts = count($products) ? count($products) : 1;
     $expectedMessage = sprintf(self::SUCCESS_MESSAGE, $countProducts);
     $actualMessage = $productGrid->getMessagesBlock()->getSuccessMessages();
     \PHPUnit_Framework_Assert::assertEquals($expectedMessage, $actualMessage, 'Wrong success message is displayed.');
 }
开发者ID:whoople,项目名称:magento2-testing,代码行数:14,代码来源:AssertMassProductUpdateSuccessMessage.php

示例11: it_returns_command_constructor_parameters

 /**
  * @test
  */
 public function it_returns_command_constructor_parameters()
 {
     $commandReflection = CommandReflection::fromClass(DummyCommand::class);
     $commandParameters = $commandReflection->parameters();
     \PHPUnit_Framework_Assert::assertEquals('argument1', $commandParameters[0]->name);
     \PHPUnit_Framework_Assert::assertEquals('argument2', $commandParameters[1]->name);
 }
开发者ID:pawaclawczyk,项目名称:command-bus-launcher,代码行数:10,代码来源:CommandReflectionTest.php

示例12: assertDestinationCorrect

 public function assertDestinationCorrect(ezcWebdavMemoryBackend $backend)
 {
     PHPUnit_Framework_Assert::assertTrue($backend->nodeExists('/other_collection/moved_resource.html'));
     $prop = $backend->getProperty('/other_collection/moved_resource.html', 'lockdiscovery');
     PHPUnit_Framework_Assert::assertNotNull($prop, 'Lock discovery property not available on destination.');
     PHPUnit_Framework_Assert::assertEquals(0, count($prop->activeLock), 'Active lock available on destination.');
 }
开发者ID:bmdevel,项目名称:ezc,代码行数:7,代码来源:015_move_resource_destination_not_locked_success_assertions.php

示例13: assertOnShoppingCart

 /**
  * Assert prices on the shopping cart.
  *
  * @param InjectableFixture $product
  * @param CheckoutCart $checkoutCart
  * @return void
  */
 protected function assertOnShoppingCart(InjectableFixture $product, CheckoutCart $checkoutCart)
 {
     $cartItem = $checkoutCart->getCartBlock()->getCartItem($product);
     $formPrice = $cartItem->getCartItemTypePrice('price');
     $fixturePrice = number_format($this->prepareFixturePrice($product), 2);
     \PHPUnit_Framework_Assert::assertEquals($fixturePrice, $formPrice, 'Product price in shopping cart is not correct.');
 }
开发者ID:hientruong90,项目名称:ee_14_installer,代码行数:14,代码来源:AssertProductInCart.php

示例14: processAssert

 /**
  * Assert Link block for downloadable product on front-end
  *
  * @param CatalogProductView $downloadableProductView
  * @param CatalogProductDownloadable $product
  * @param Browser $browser
  * @return void
  */
 public function processAssert(CatalogProductView $downloadableProductView, CatalogProductDownloadable $product, Browser $browser)
 {
     $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
     $linksBlock = $downloadableProductView->getDownloadableViewBlock()->getDownloadableLinksBlock();
     $fields = $product->getData();
     // Title for for Link block
     \PHPUnit_Framework_Assert::assertEquals($linksBlock->getTitleForLinkBlock(), $fields['downloadable_links']['title'], 'Title for for Link block for downloadable product on front-end is not correct.');
     $this->sortDownloadableArray($fields['downloadable_links']['downloadable']['link']);
     foreach ($fields['downloadable_links']['downloadable']['link'] as $index => $link) {
         $index++;
         // Titles for each links
         // Links are displaying according to Sort Order
         \PHPUnit_Framework_Assert::assertEquals($linksBlock->getItemTitle($index), $link['title'], 'Link item ' . $index . ' with title "' . $link['title'] . '" is not visible.');
         // If Links can be Purchase Separately, check-nob is presented near each link
         // If Links CANNOT be Purchase Separately, check-nob is not presented near each link
         if ($fields['downloadable_links']['links_purchased_separately'] == "Yes") {
             \PHPUnit_Framework_Assert::assertTrue($linksBlock->isVisibleItemCheckbox($index), 'Item ' . $index . ' link block CANNOT be Purchase Separately.');
             // Price is equals passed according to fixture
             $link['price'] = sprintf('$%1.2f', $link['price']);
             \PHPUnit_Framework_Assert::assertEquals($linksBlock->getItemPrice($index), $link['price'], 'Link item ' . $index . ' price is not visible.');
         } elseif ($fields['downloadable_links']['links_purchased_separately'] == "No") {
             \PHPUnit_Framework_Assert::assertFalse($linksBlock->isVisibleItemCheckbox($index), 'Item ' . $index . ' link block can be Purchase Separately.');
         }
     }
 }
开发者ID:aiesh,项目名称:magento2,代码行数:33,代码来源:AssertDownloadableLinksData.php

示例15: processAssert

 /**
  * Assert that Order Grand Total is correct on order page in backend.
  *
  * @param SalesOrderIndex $salesOrder
  * @param SalesOrderView $salesOrderView
  * @param mixed $grandTotal
  * @param string $orderId
  * @return void
  */
 public function processAssert(SalesOrderIndex $salesOrder, SalesOrderView $salesOrderView, $grandTotal, $orderId)
 {
     $salesOrder->open()->getSalesOrderGrid()->searchAndOpen(['id' => $orderId]);
     $expected = number_format(is_array($grandTotal) ? array_sum($grandTotal) : $grandTotal, 2);
     $actual = $salesOrderView->getOrderForm()->getTabElement('information')->getOrderTotalsBlock()->getData('grand_total');
     \PHPUnit_Framework_Assert::assertEquals($expected, $actual, "Expected: {$expected}; Actual: {$actual}");
 }
开发者ID:chucky515,项目名称:Magento-CE-Mirror,代码行数:16,代码来源:AssertOrderGrandTotal.php


注:本文中的PHPUnit_Framework_Assert::assertEquals方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。