assertEquals() public static method

Asserts that two variables are equal.
public static assertEquals ( mixed $expected, mixed $actual, string $message = '', float $delta, integer $maxDepth = 10, boolean $canonicalize = false, boolean $ignoreCase = false )
$expected mixed
$actual mixed
$message string
$delta float
$maxDepth integer
$canonicalize boolean
$ignoreCase boolean
 /**
  * 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.');
 }
 /**
  * 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);
 }
 /**
  * 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);
 }
 /**
  * @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);
 }
 /**
  * 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);
 }
 public function testDecodeDestinationInstruction()
 {
     $decoder = new Decoder();
     $result = $decoder->decodeInstruction('53574150424f540000c56cb39f9b289c0ec4ef6943fa107c904820fe0980df2772');
     $expected = ['operation' => 'destination', 'address' => '1JztLWos5K7LsqW5E78EASgiVBaCe6f7cD'];
     PHPUnit::assertEquals($expected, $result);
 }
Example #7
0
 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());
 }
 /**
  * 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.');
 }
 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());
         }
     }
 }
 /**
  * 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.');
 }
 /**
  * @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);
 }
 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.');
 }
 /**
  * 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.');
 }
 /**
  * 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.');
         }
     }
 }
 /**
  * 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}");
 }
 /**
  * Assert that displayed category data on category page equals to passed from fixture
  *
  * @param CatalogCategory $category
  * @param CatalogCategory $initialCategory
  * @param FixtureFactory $fixtureFactory
  * @param CatalogCategoryView $categoryView
  * @param Browser $browser
  * @return void
  */
 public function processAssert(CatalogCategory $category, CatalogCategory $initialCategory, FixtureFactory $fixtureFactory, CatalogCategoryView $categoryView, Browser $browser)
 {
     $product = $fixtureFactory->createByCode('catalogProductSimple', ['dataSet' => 'default', 'data' => ['category_ids' => ['category' => $initialCategory]]]);
     $categoryData = array_merge($initialCategory->getData(), $category->getData());
     $product->persist();
     $url = $_ENV['app_frontend_url'] . strtolower($category->getUrlKey()) . '.html';
     $browser->open($url);
     \PHPUnit_Framework_Assert::assertEquals($url, $browser->getUrl(), 'Wrong page URL.' . "\nExpected: " . $url . "\nActual: " . $browser->getUrl());
     if (isset($categoryData['name'])) {
         $title = $categoryView->getTitleBlock()->getTitle();
         \PHPUnit_Framework_Assert::assertEquals($categoryData['name'], $title, 'Wrong page title.' . "\nExpected: " . $categoryData['name'] . "\nActual: " . $title);
     }
     if (isset($categoryData['description'])) {
         $description = $categoryView->getViewBlock()->getDescription();
         \PHPUnit_Framework_Assert::assertEquals($categoryData['description'], $description, 'Wrong category description.' . "\nExpected: " . $categoryData['description'] . "\nActual: " . $description);
     }
     if (isset($categoryData['default_sort_by'])) {
         $sortBy = strtolower($categoryData['default_sort_by']);
         $sortType = $categoryView->getTopToolbar()->getSelectSortType();
         \PHPUnit_Framework_Assert::assertEquals($sortBy, $sortType, 'Wrong sorting type.' . "\nExpected: " . $sortBy . "\nActual: " . $sortType);
     }
     if (isset($categoryData['available_sort_by'])) {
         $availableSortType = array_filter($categoryData['available_sort_by'], function (&$value) {
             return $value !== '-' && ucfirst($value);
         });
         if ($availableSortType) {
             $availableSortType = array_values($availableSortType);
             $availableSortTypeOnPage = $categoryView->getTopToolbar()->getSortType();
             \PHPUnit_Framework_Assert::assertEquals($availableSortType, $availableSortTypeOnPage, 'Wrong available sorting type.' . "\nExpected: " . implode(PHP_EOL, $availableSortType) . "\nActual: " . implode(PHP_EOL, $availableSortTypeOnPage));
         }
     }
 }
 /**
  * Verify item product data.
  *
  * @param InjectableFixture $product
  * @param int|null $expectedQty
  * @return void
  */
 protected function verifyItemProduct(InjectableFixture $product, $expectedQty)
 {
     \PHPUnit_Framework_Assert::assertTrue($this->wishlistIndex->getItemsBlock()->getItemProductBlock($product)->isVisible(), 'Product "' . $product->getName() . '" in custom wishlist doesn\'t visible.');
     if ($expectedQty !== null) {
         \PHPUnit_Framework_Assert::assertEquals($expectedQty, $this->wishlistIndex->getItemsBlock()->getItemProductBlock($product)->getData()['qty'], 'Actual quantity of "' . $product->getName() . '" in custom wishlist doesn\'t match to expected.');
     }
 }
 /**
  * Assert that the category cannot be accessed from the navigation bar in the frontend
  *
  * @param CmsIndex $cmsIndex
  * @param Category $category
  * @param BrowserInterface $browser
  * @return void
  */
 public function processAssert(CmsIndex $cmsIndex, Category $category, BrowserInterface $browser)
 {
     $cmsIndex->open();
     \PHPUnit_Framework_Assert::assertFalse($cmsIndex->getTopmenu()->isCategoryVisible($category->getName()), 'Category can be accessed from the navigation bar in the frontend.');
     $browser->open($_ENV['app_frontend_url'] . $category->getUrlKey() . '.html');
     \PHPUnit_Framework_Assert::assertEquals(self::NOT_FOUND_MESSAGE, $cmsIndex->getTitleBlock()->getTitle(), 'Wrong page is displayed.');
 }
Example #19
0
 private function call($method, $url, $value = null)
 {
     PHPUnit_Framework_Assert::assertEquals($this->call['method'], $method);
     PHPUnit_Framework_Assert::assertEquals($this->call['url'], $url);
     PHPUnit_Framework_Assert::assertEquals($this->call['value'], $value);
     return $this->call['and_return'];
 }
Example #20
0
 public function testUtils()
 {
     // public key from WIF
     PHPUnit::assertEquals('03f05b88087b2392611d0eb388f11543b02b21d12c18aba21699e73e97a61fee15', BitcoinKeyUtils::publicKeyFromWIF('L2KB5RqtHwLKrNaVuxQCiNs549vbp4oy7FTF2zs2GChLXXnXyMee'));
     $caught_error = false;
     try {
         BitcoinKeyUtils::publicKeyFromWIF('BADWIF');
     } catch (Exception $e) {
         $caught_error = true;
     }
     PHPUnit::assertTrue($caught_error);
     // address from WIF
     PHPUnit::assertEquals('1NjZ3zsBySHtCWX3NtPFfmUXEwx7XeG82H', BitcoinKeyUtils::addressFromWIF('L2KB5RqtHwLKrNaVuxQCiNs549vbp4oy7FTF2zs2GChLXXnXyMee'));
     $caught_error = false;
     try {
         BitcoinKeyUtils::addressFromWIF('BADWIF');
     } catch (Exception $e) {
         $caught_error = true;
     }
     PHPUnit::assertTrue($caught_error);
     $generator = $this->getGenerator();
     $private_key = $generator->privateKey('mytoken1');
     PHPUnit::assertEquals('034fba8396613ae90defdc45e2e924a4bda2e1b94d653d4d28111523cc57ccb8d7', BitcoinKeyUtils::publicKeyFromPrivateKey($private_key)->getHex());
     PHPUnit::assertEquals('L4iQRBZz1XuqvE6qyfQZAn6AtiudyT9dnQTvnHU5n3TQ9G45sPJ3', BitcoinKeyUtils::WIFFromPrivateKey($private_key));
 }
Example #21
0
 /**
  * Checks if the cookies were set correctly.
  *
  * @param PHPUnit_Framework_Assert test    The test from which this is called
  * @param array(string => mixed)   cookies The cookie data to check against.
  *				The keys are cookie names, the values can either be null to
  *				check only the existance of the cookie, or an array(d, t),
  *				where d is the cookie data to check, or null to skip the
  *				check and t is the cookie time to check, or null to skip.
  */
 public function check_cookies(PHPUnit_Framework_Assert $test, $cookies)
 {
     $test->assertEquals(array_keys($cookies), array_keys($this->_cookies), 'Incorrect cookies were set');
     foreach ($cookies as $name => $cookie) {
         if (!is_null($cookie)) {
             $data = $cookie[0];
             $time = $cookie[1];
             if (!is_null($data)) {
                 $test->assertEquals($data, $this->_cookies[$name][0], "Cookie {$name} contains incorrect data");
             }
             if (!is_null($time)) {
                 $test->assertEquals($time, $this->_cookies[$name][1], "Cookie {$name} expires at the wrong time");
             }
         }
     }
 }
 public function testXCPDClient()
 {
     $asset_info = $this->sampleLTBCoinAssetInfo();
     $cache = $this->app->make('Tokenly\\CounterpartyAssetInfoCache\\Cache');
     PHPUnit::assertEquals($asset_info, $cache->get('LTBCOIN'));
     PHPUnit::assertEquals($asset_info, $cache->getFromCache('LTBCOIN'));
 }
 /**
  * Assert that success save message is appeared on the Integrations page
  *
  * @param IntegrationIndex $integrationIndexPage
  * @param Integration $integration
  * @param Integration|null $initialIntegration
  * @return void
  */
 public function processAssert(IntegrationIndex $integrationIndexPage, Integration $integration, Integration $initialIntegration = null)
 {
     $name = $initialIntegration !== null && !$integration->hasData('name') ? $initialIntegration->getName() : $integration->getName();
     $expectedMessage = sprintf(self::SUCCESS_SAVE_MESSAGE, $name);
     $actualMessage = $integrationIndexPage->getMessagesBlock()->getSuccessMessage();
     \PHPUnit_Framework_Assert::assertEquals($expectedMessage, $actualMessage, 'Wrong success message is displayed.' . "\nExpected: " . $expectedMessage . "\nActual: " . $actualMessage);
 }
Example #24
0
 function it_is_serializable()
 {
     $that = new PlayerCard();
     $that->setTitle('Lorem ipsum');
     $that = unserialize(serialize($that));
     \PHPUnit_Framework_Assert::assertEquals('Lorem ipsum', $that->getTitle());
 }
 public function run(\PHPUnit_Framework_TestResult $result = null)
 {
     if (!$result) {
         $result = new \PHPUnit_Framework_TestResult();
     }
     $opt = null;
     \PHP_Timer::start();
     $result->startTest($this);
     try {
         $opt = \Docopt::handle($this->doc, array('argv' => $this->argv, 'exit' => false));
     } catch (\Exception $ex) {
         // gulp
     }
     $found = null;
     if ($opt) {
         if (!$opt->success) {
             $found = array('user-error');
         } elseif (empty($opt->args)) {
             $found = array();
         } else {
             $found = $opt->args;
         }
     }
     $time = \PHP_Timer::stop();
     try {
         \PHPUnit_Framework_Assert::assertEquals($this->expect, $found);
     } catch (\PHPUnit_Framework_AssertionFailedError $e) {
         $result->addFailure($this, $e, $time);
     }
     $result->endTest($this, $time);
     return $result;
 }
Example #26
0
function test($instance, $before, $after)
{
    $instance->server('request_method', $before);
    \PHPUnit_Framework_Assert::assertEquals($before, $instance->curl->responseHeaders['X-REQUEST-METHOD']);
    $instance->server('request_method', $after);
    \PHPUnit_Framework_Assert::assertEquals($after, $instance->curl->responseHeaders['X-REQUEST-METHOD']);
}
 public function testTransactionType()
 {
     $parser = new Parser();
     $tx_data = $this->getSampleCounterpartyTransaction();
     $type = $parser->lookupCounterpartyTransactionType($tx_data, 1);
     PHPUnit::assertEquals('send', $type);
 }
 /**
  * Assert that grand total is equal to expected
  *
  * @param CheckoutCart $checkoutCart
  * @param Cart $cart
  * @return void
  */
 public function processAssert(CheckoutCart $checkoutCart, Cart $cart)
 {
     $checkoutCart->open();
     $fixtureGrandTotal = number_format($cart->getGrandTotal(), 2);
     $pageGrandTotal = $checkoutCart->getTotalsBlock()->getGrandTotal();
     \PHPUnit_Framework_Assert::assertEquals($fixtureGrandTotal, $pageGrandTotal, 'Grand total price in the shopping cart not equals to grand total price from fixture.');
 }
 function it_should_create_catalog_if_not_exists()
 {
     $root = vfsStream::setup('home', 0775, []);
     $this->toFile(vfsStream::url('home/files'));
     $dockerfile = $root->getChild('files/Dockerfile');
     \PHPUnit_Framework_Assert::assertEquals('FROM registry.madkom.pl/php:5.6-cli', $dockerfile->getContent());
 }
 /**
  * Assert that newsletter preview opened in new window and template content correct
  *
  * @param BrowserInterface $browser
  * @param TemplatePreview $templatePreview
  * @param Template $newsletter
  * @return void
  */
 public function processAssert(BrowserInterface $browser, TemplatePreview $templatePreview, Template $newsletter)
 {
     $browser->selectWindow();
     $content = $templatePreview->getContent()->getPageContent();
     $browser->closeWindow();
     \PHPUnit_Framework_Assert::assertEquals($newsletter->getText(), $content, 'Template content not correct information.');
 }