assertGreaterThan() 공개 정적인 메소드

Asserts that a value is greater than another value.
public static assertGreaterThan ( mixed $expected, mixed $actual, string $message = '' )
$expected mixed
$actual mixed
$message string
 /**
  * @test
  */
 public function it_can_return_its_id()
 {
     $conn = $this->factory->createConnection('localhost');
     $channel = $this->factory->createChannel($conn);
     Assert::assertInternalType('integer', $channel->getChannelId());
     Assert::assertGreaterThan(0, $channel->getChannelId());
 }
예제 #2
1
 public function seeInDatabase($table, $criteria = array())
 {
     $res = $this->proceedSeeInDatabase($table, 'count(*)', $criteria);
     \PHPUnit_Framework_Assert::assertGreaterThan(0, $res, 'No matching records found');
 }
예제 #3
0
 public function imagesAreSimilarInPercent($percent)
 {
     $similarity = ImageSimilarityJudge::judge($this->originalImage, $this->optimizedImage);
     $percent = $percent / 100;
     \PHPUnit_Framework_Assert::assertGreaterThan($percent, $similarity);
     return $this;
 }
예제 #4
0
 private function listEntities($entityType)
 {
     Debug::debug("List {$entityType}");
     $response = $this->sendRequest("{$entityType}", null, 'GET');
     PHPUnit_Framework_Assert::assertGreaterThan(0, count($response->data));
     return $response;
 }
예제 #5
0
 public function toBeLessThanOrEqualTo($expected)
 {
     if ($this->negate) {
         a::assertGreaterThan($expected, $this->actual);
     } else {
         a::assertLessThanOrEqual($expected, $this->actual);
     }
 }
예제 #6
0
 /**
  * @Given /^response contains only the user with the email "([^"]*)"$/
  */
 public function responseContainsOnlyUsersWithTheEmail($email)
 {
     $userList = $this->getResponseObject();
     Assertion::assertGreaterThan(0, count($userList), 'UserList was expected to contain one user only');
     foreach ($userList as $user) {
         Assertion::assertInstanceOf('eZ\\Publish\\API\\Repository\\Values\\User\\User', $user, 'Non User found in the response');
         Assertion::assertEquals($email, $user->email, "UserList was expected to contain only users with email '{$email}'");
     }
 }
 public function testAPI()
 {
     $api = new RippleAPI(new Connection());
     $index = $api->currentLedgerIndex();
     PHPUnit::assertNotNull($index);
     PHPUnit::assertGreaterThan(6000000, $index);
     $index = $api->currentLedgerIndex();
     PHPUnit::assertNotNull($index);
     PHPUnit::assertGreaterThan(6000000, $index);
 }
예제 #8
0
 public function testCLIAddUser()
 {
     // insert
     $this->app['Illuminate\\Contracts\\Console\\Kernel']->call('api:new-user', ['email' => '*****@*****.**']);
     // load from repo
     $user_repo = $this->app->make('App\\Repositories\\UserRepository');
     $loaded_user_model = $user_repo->findByEmail('*****@*****.**');
     PHPUnit::assertNotEmpty($loaded_user_model);
     PHPUnit::assertGreaterThan(0, $loaded_user_model['id']);
     PHPUnit::assertEquals('*****@*****.**', $loaded_user_model['email']);
 }
예제 #9
0
파일: ListCest.php 프로젝트: t4web/Modules
 public function tryList(FunctionalTester $I)
 {
     $I->wantTo("Check module list output");
     $this->routeMatch->setParam('action', 'show');
     $result = $this->controller->dispatch(new ConsoleRequest(array(0 => 'public/index.php', 1 => 'modules', 2 => 'list')));
     /** @var Zend\Http\PhpEnvironment\Response $response */
     $response = $this->controller->getResponse();
     \PHPUnit_Framework_Assert::assertEquals(200, $response->getStatusCode());
     \PHPUnit_Framework_Assert::assertEquals('', $result);
     \PHPUnit_Framework_Assert::assertInstanceOf('ComposerLockParser\\PackagesCollection', $this->viewModel->getPackages());
     \PHPUnit_Framework_Assert::assertGreaterThan(0, $this->viewModel->getPackages()->count());
     \PHPUnit_Framework_Assert::assertInstanceOf('ComposerLockParser\\Package', $this->viewModel->getPackages()->getByName('t4web/modules'));
 }
예제 #10
0
 public function testAddBTCTransaction()
 {
     // insert
     $transaction_model = $this->txHelper()->createSampleTransaction('sample_btc_parsed_01.json');
     $parsed_tx = $transaction_model['parsed_tx'];
     // load from repo
     $tx_repo = $this->app->make('App\\Repositories\\TransactionRepository');
     $loaded_transaction_model = $tx_repo->findByTXID($parsed_tx['txid']);
     PHPUnit::assertNotEmpty($loaded_transaction_model);
     PHPUnit::assertEquals($parsed_tx['txid'], $loaded_transaction_model['txid']);
     PHPUnit::assertEquals(0, $loaded_transaction_model['is_mempool']);
     PHPUnit::assertEquals('00000000000000003a1e5abc2d7af7f38a614d2fcbafe309b7e8aa147d508a9c', $loaded_transaction_model['block_confirmed_hash']);
     PHPUnit::assertGreaterThan(0, $loaded_transaction_model['id']);
 }
 public function testBitstampDriver()
 {
     $client = $this->getQuoteClient();
     $quotes = $client->getQuotes('bitstamp', [['base' => 'USD', 'target' => 'BTC']]);
     if (getenv('ECHO_QUOTES')) {
         echo "\$quotes:\n" . json_encode($quotes, 192) . "\n";
     }
     PHPUnit::assertInstanceOf('Tokenly\\CryptoQuoteClient\\Quote', $quotes[0]);
     PHPUnit::assertGreaterThan(100, $quotes[0]['bid']);
     PHPUnit::assertGreaterThan(100, $quotes[0]['ask']);
     PHPUnit::assertGreaterThan(100, $quotes[0]['last']);
     $quote = $client->getQuote('bitstamp', 'USD', 'BTC');
     if (getenv('ECHO_QUOTES')) {
         echo "\$quote:\n" . json_encode($quote, 192) . "\n";
     }
     PHPUnit::assertGreaterThan(100, $quote['bid']);
     PHPUnit::assertGreaterThan(100, $quote['ask']);
     PHPUnit::assertGreaterThan(100, $quote['last']);
 }
예제 #12
0
 public function testAllScenarios()
 {
     $starting_scenario_number = getenv('SCENARIO');
     if (!$starting_scenario_number) {
         $starting_scenario_number = 1;
     }
     // do all state tests in directory
     $scenario_number_count = count(glob(base_path() . '/tests/fixtures/scenarios/*.yml'));
     PHPUnit::assertGreaterThan(0, $scenario_number_count);
     for ($i = $starting_scenario_number; $i <= $scenario_number_count; $i++) {
         Log::debug("\n" . str_repeat('-', 60) . "\nBEGIN SCENARIO: {$i}\n" . str_repeat('-', 60));
         // clear the db
         if ($i > 1) {
             $this->resetForScenario();
         }
         try {
             $this->runScenario($i);
         } catch (Exception $e) {
             echo "\nFailed while running scenario {$i}\n";
             throw $e;
         }
     }
 }
 public static function setupBeforeClass()
 {
     parent::setUpBeforeClass();
     if (!file_exists(_PS_MODULE_DIR_ . '/prestafraud/prestafraud.php')) {
         $download = file_put_contents(_PS_CACHE_DIR_ . 'sandbox/prestafraud.zip', Tools::addonsRequest('module', array('id_module' => 4181)));
         Assert::assertGreaterThan(20000, $download, 'Fail download module from Addons');
         $extract = Tools::ZipExtract(_PS_CACHE_DIR_ . 'sandbox/prestafraud.zip', _PS_MODULE_DIR_);
         Assert::assertTrue($extract, 'Fail extract module');
         unlink(_PS_CACHE_DIR_ . 'sandbox/prestafraud.zip');
     }
     self::$prestafraud = Module::getInstanceByName('prestafraud');
     Assert::assertTrue(is_object(self::$prestafraud), 'Fail Module::getInstanceByName(\'prestafraud\')');
     Assert::assertEquals('prestafraud', self::$prestafraud->name);
     if (!Module::isInstalled('prestafraud')) {
         Assert::assertTrue((bool) self::$prestafraud->install());
     }
     Assert::assertTrue((bool) self::$prestafraud->isRegisteredInHook('actionValidateOrder'), 'Fail Module::isRegisteredInHook(\'actionValidateOrder\')');
     $uniqid = uniqid() . time();
     $email = 'prestabot+' . $uniqid . '@gmail.com';
     $shop_url = 'http://www.prestashop-unit-test-' . $uniqid . '.com/';
     $result = self::$prestafraud->_createAccount($email, $shop_url);
     Assert::assertTrue($result, implode(', ', self::$prestafraud->_errors));
 }
 /**
  * @Then /^I should have a list of posts$/
  */
 public function iShouldHaveAListOfPosts()
 {
     Assert::assertGreaterThan(0, count(self::$categoryPosts));
 }
 /**
  * Checks if collection contains an item.
  *
  * ``` php
  * <?php
  * $I->seeInDatabaseCollection('database', 'users', array('name' => 'miles'));
  * ```
  *
  * @param       $database
  * @param       $collection
  * @param array $criteria
  */
 public function seeInDatabaseCollection($database, $collection, $criteria = array())
 {
     $this->checkDatabase($database);
     $collection = $this->drivers[$database]->getDbh()->selectCollection($collection);
     $res = $collection->count($criteria);
     \PHPUnit_Framework_Assert::assertGreaterThan(0, $res);
 }
예제 #16
0
 /**
  * Checks if any email were sent by last request
  *
  * @throws \LogicException
  */
 public function seeEmailIsSent()
 {
     $profile = $this->getProfiler();
     if (!$profile) {
         \PHPUnit_Framework_Assert::fail('Emails can\'t be tested without Profiler');
     }
     if (!$profile->hasCollector('swiftmailer')) {
         \PHPUnit_Framework_Assert::fail('Emails can\'t be tested without SwiftMailer connector');
     }
     \PHPUnit_Framework_Assert::assertGreaterThan(0, $profile->getCollector('swiftmailer')->getMessageCount());
 }
예제 #17
0
 /**
  * @depends testGetAllSettings
  */
 public function testSettingDomains()
 {
     // Create Parent Child Settings
     $parentSetting = array('domain' => "ParentDomain", 'settingKey' => 'ParentKey', 'value' => 'ChildDomain', 'type' => 'text', 'parent' => null);
     $ret = self::$pdo->create($parentSetting);
     PHPUnit_Framework_Assert::assertNotNull($ret);
     PHPUnit_Framework_Assert::assertEquals($ret['value'], 'ChildDomain');
     $childSetting = array('domain' => "ChildDomain", 'type' => 'text', 'parent' => 'ParentDomain');
     $childCount = 10;
     for ($i = 1; $i <= $childCount; $i++) {
         $childSetting['settingKey'] = 'ChildKey.' . $i;
         $childSetting['value'] = 'ChildValue.' . $i;
         $ret = self::$pdo->create($childSetting);
         PHPUnit_Framework_Assert::assertNotNull($ret);
     }
     // All Settings
     $settings = self::$pdo->getAll();
     PHPUnit_Framework_Assert::assertGreaterThan($childCount, count($settings));
     PHPUnit_Framework_Assert::assertNotNull($settings[0]['domain']);
     // fwrite(STDERR, print_r('Number of settings: '.count($settings)."\n",
     // TRUE));
     // All Settings For One Domain
     $settings = self::$pdo->getAllDomain('ChildDomain');
     PHPUnit_Framework_Assert::assertEquals($childCount, count($settings));
     PHPUnit_Framework_Assert::assertNotNull($settings[0]['domain']);
     // fwrite(STDERR, print_r('Domain for first setting:
     // '.$settings[0]['domain']."\n", TRUE));
     // fwrite(STDERR, print_r('Setting for first setting:
     // '.$settings[0]['setting']."\n", TRUE));
     // fwrite(STDERR, print_r('Value for first setting:
     // '.$settings[0]['value']."\n", TRUE));
     // Domain List
     $domains = self::$pdo->getDomains();
     PHPUnit_Framework_Assert::assertGreaterThan(2, count($domains));
     PHPUnit_Framework_Assert::assertNotNull($domains[0]);
     // Delete all settings for specified domain
     self::$pdo->deleteAllDomain('ChildDomain');
     $settings = self::$pdo->getAllDomain('ChildDomain');
     PHPUnit_Framework_Assert::assertEquals(0, count($settings));
     self::$pdo->deleteAllDomain('ParentDomain');
     $settings = self::$pdo->getAllDomain('ParentDomain');
     PHPUnit_Framework_Assert::assertEquals(0, count($settings));
 }
 /**
  * @Then I should have suggestions available to correct the address
  */
 public function iShouldHaveSuggestionsAvailableToCorrectTheAddress()
 {
     $suggestions = $this->getSession()->getPage()->findAll('css', '#form-validate .suggestion-list input[name="suggestion"]');
     // Two suggestions will always be included - confirm address or use new
     // address. To ensure that additional suggestions to pick a corrected
     // address are available, there must be more than those two options.
     Assert::assertGreaterThan(2, count($suggestions));
 }
예제 #19
0
 /**
  * Checks if collection contains an item.
  *
  * ``` php
  * <?php
  * $I->seeInCollection('users', array('name' => 'miles'));
  * ```
  *
  * @param $collection
  * @param array $criteria
  */
 public function seeInCollection($collection, $criteria = array())
 {
     $collection = $this->driver->getDbh()->selectCollection($collection);
     $res = $collection->count($criteria);
     \PHPUnit_Framework_Assert::assertGreaterThan(0, $res);
 }
예제 #20
0
 public function seeCheckboxIsChecked($checkbox)
 {
     $checkboxes = $this->crawler->filter($checkbox);
     \PHPUnit_Framework_Assert::assertGreaterThan(0, $checkboxes->filter('input[checked=checked]')->count());
 }
예제 #21
0
 /**
  * Checks if there were at least one email sent through Symfony test mailer.
  */
 public function seeEmailReceived()
 {
     $this->debug('Emails sent: ' . $this->browser->getContext()->getMailer()->getLogger()->countMessages());
     \PHPUnit_Framework_Assert::assertGreaterThan(0, $this->browser->getContext()->getMailer()->getLogger()->countMessages(), "");
 }
예제 #22
0
 public function greaterThan($expected)
 {
     a::assertGreaterThan($expected, $this->actual, $this->description);
 }
예제 #23
0
 /**
  * @Given /^the View contains Search Hits$/
  */
 public function theViewContainsSearchHits()
 {
     /** @var View $view */
     $view = $this->getResponseObject();
     Assertion::assertGreaterThan(1, count($view->result->searchHits));
 }
예제 #24
0
 /**
  * null $shippingCost is interpreted as free shipping
  * Carriers are cached by $name.
  */
 private static function getIdCarrier($name, $shippingCost = null, $id_tax_rules_group = null)
 {
     static $carriers = array();
     if (!array_key_exists($name, $carriers)) {
         $carrier = new Carrier(null, self::getDefaultLanguageId());
         $carrier->name = $name;
         $carrier->delay = '28 days later';
         if (null === $shippingCost) {
             $carrier->is_free = true;
         } else {
             $carrier->range_behavior = false;
             // take highest range
             $carrier->shipping_method = Carrier::SHIPPING_METHOD_PRICE;
         }
         $carrier->shipping_handling = false;
         Assert::assertTrue($carrier->save());
         if (null !== $id_tax_rules_group) {
             $carrier->setTaxRulesGroup($id_tax_rules_group);
         }
         if (null !== $shippingCost) {
             // Populate one range
             Db::getInstance()->execute('INSERT INTO ' . _DB_PREFIX_ . 'range_price (id_carrier, delimiter1, delimiter2) VALUES (
                 ' . (int) $carrier->id . ',
                 0,1
             )');
             $id_range_price = Db::getInstance()->Insert_ID();
             Assert::assertGreaterThan(0, $id_range_price);
             // apply our shippingCost to all zones
             Db::getInstance()->execute('INSERT INTO ' . _DB_PREFIX_ . 'delivery (id_carrier, id_range_price, id_range_weight, id_zone, price)
                  SELECT ' . (int) $carrier->id . ', ' . (int) $id_range_price . ', 0, id_zone, ' . (double) $shippingCost . '
                  FROM ' . _DB_PREFIX_ . 'zone');
             // enable all zones
             Db::getInstance()->execute('INSERT INTO ' . _DB_PREFIX_ . 'carrier_zone (id_carrier, id_zone)
                  SELECT ' . (int) $carrier->id . ', id_zone FROM ' . _DB_PREFIX_ . 'zone');
         }
         $carriers[$name] = $carrier->id;
     }
     return $carriers[$name];
 }
예제 #25
0
 /**
  * Expect that a value is greater than another value.
  *
  * @param mixed $expected
  * @param string $message
  *
  * @return Expect
  */
 public function toBeGreaterThan($expected, $message = '')
 {
     Assert::assertGreaterThan($expected, $this->value, $message);
     return $this;
 }
예제 #26
0
 /**
  * @depends testCreateForum
  */
 public function testEnrollment($forumId)
 {
     // Invite User to Forum
     self::$pdo->setForumEnrollmentStatus($forumId, SELF::USER_ID, EnrollmentStatus::Invited);
     $enrollmentStatus = self::$pdo->getForumEnrollmentStatus($forumId, SELF::USER_ID);
     PHPUnit_Framework_Assert::assertNotNull($enrollmentStatus);
     PHPUnit_Framework_Assert::assertEquals(EnrollmentStatus::Invited, $enrollmentStatus);
     $forums = self::$pdo->getInvitations(SELF::USER_ID);
     PHPUnit_Framework_Assert::assertNotNull($enrollmentStatus);
     PHPUnit_Framework_Assert::assertEquals(1, count($forums));
     // Enroll User in Forum
     self::$pdo->setForumEnrollmentStatus($forumId, SELF::USER_ID, EnrollmentStatus::Joined);
     $enrollmentStatus = self::$pdo->getForumEnrollmentStatus($forumId, SELF::USER_ID);
     PHPUnit_Framework_Assert::assertNotNull($enrollmentStatus);
     PHPUnit_Framework_Assert::assertEquals(EnrollmentStatus::Joined, $enrollmentStatus);
     // All Forums for User
     $forums = self::$pdo->getForumsForUser(SELF::USER_ID);
     PHPUnit_Framework_Assert::assertEquals(1, count($forums));
     PHPUnit_Framework_Assert::assertNotNull($forums[0]['name']);
     // All Enrolled Users for a Forum
     $enrollment = self::$pdo->getEnrolledUsers($forumId);
     PHPUnit_Framework_Assert::assertGreaterThan(0, count($enrollment));
     //AppUtils::logDebug($enrollment[0]);
     PHPUnit_Framework_Assert::assertNotNull($enrollment[0]['id']);
     PHPUnit_Framework_Assert::assertNotNull($enrollment[0]['firstName']);
     PHPUnit_Framework_Assert::assertNotNull($enrollment[0]['lastName']);
     PHPUnit_Framework_Assert::assertNotNull($enrollment[0]['email']);
     // All Users NOT Enrolled for a Forum
     $enrollment = self::$pdo->getForumEnrollment($forumId, false);
     PHPUnit_Framework_Assert::assertGreaterThan(0, count($enrollment));
     // All Enrolled Users for All Forums (admin function)
     $enrollment = self::$pdo->getAllForumEnrollment();
     PHPUnit_Framework_Assert::assertGreaterThan(0, count($enrollment));
     PHPUnit_Framework_Assert::assertNotNull($enrollment[0]['enrollmentStatus']);
     PHPUnit_Framework_Assert::assertNotNull($enrollment[0]['forum']['id']);
     PHPUnit_Framework_Assert::assertNotNull($enrollment[0]['forum']['name']);
     PHPUnit_Framework_Assert::assertNotNull($enrollment[0]['user']['id']);
     PHPUnit_Framework_Assert::assertNotNull($enrollment[0]['user']['firstName']);
     PHPUnit_Framework_Assert::assertNotNull($enrollment[0]['user']['lastName']);
     PHPUnit_Framework_Assert::assertNotNull($enrollment[0]['user']['email']);
     // Change Enrollment Status User in Forum
     self::$pdo->setForumEnrollmentStatus($forumId, SELF::USER_ID, EnrollmentStatus::Joined);
     $enrollmentStatus = self::$pdo->getForumEnrollmentStatus($forumId, SELF::USER_ID);
     PHPUnit_Framework_Assert::assertNotNull($enrollmentStatus);
     PHPUnit_Framework_Assert::assertEquals(EnrollmentStatus::Joined, $enrollmentStatus);
     // Test Pending Join Request List
     self::$pdo->setForumEnrollmentStatus($forumId, SELF::USER_ID2, EnrollmentStatus::Pending);
     $enrollmentStatus = self::$pdo->getForumEnrollmentStatus($forumId, SELF::USER_ID2);
     PHPUnit_Framework_Assert::assertNotNull($enrollmentStatus);
     PHPUnit_Framework_Assert::assertEquals(EnrollmentStatus::Pending, $enrollmentStatus);
     $pendingList = self::$pdo->getPendingJoinRequests(SELF::USER_ID);
     PHPUnit_Framework_Assert::assertNotNull($pendingList);
     PHPUnit_Framework_Assert::assertEquals(1, count($pendingList));
     // Delete Enrollment for User in Forum
     self::$pdo->deleteForumEnrollment($forumId, SELF::USER_ID);
     $enrollmentStatus = self::$pdo->getForumEnrollmentStatus($forumId, SELF::USER_ID);
     PHPUnit_Framework_Assert::assertNull($enrollmentStatus);
     self::$pdo->deleteForumEnrollment($forumId, SELF::USER_ID2);
     return $forumId;
 }
 public function testDownloadCallback()
 {
     // Upload a file.
     $upload_file_path = Helper\get_png();
     $upload_test = new Test();
     $upload_test->server('upload_response', 'POST', array('image' => '@' . $upload_file_path));
     $uploaded_file_path = $upload_test->curl->response->file_path;
     // Download the file.
     $download_callback_called = false;
     $multi_curl = new MultiCurl();
     $multi_curl->setHeader('X-DEBUG-TEST', 'download_response');
     $multi_curl->addDownload(Test::TEST_URL . '?' . http_build_query(array('file_path' => $uploaded_file_path)), function ($instance, $fh) use(&$download_callback_called) {
         PHPUnit_Framework_Assert::assertFalse($download_callback_called);
         PHPUnit_Framework_Assert::assertInstanceOf('Curl\\Curl', $instance);
         PHPUnit_Framework_Assert::assertTrue(is_resource($fh));
         PHPUnit_Framework_Assert::assertEquals('stream', get_resource_type($fh));
         PHPUnit_Framework_Assert::assertGreaterThan(0, strlen(stream_get_contents($fh)));
         PHPUnit_Framework_Assert::assertEquals(0, strlen(stream_get_contents($fh)));
         PHPUnit_Framework_Assert::assertTrue(fclose($fh));
         $download_callback_called = true;
     });
     $multi_curl->start();
     $this->assertTrue($download_callback_called);
     // Remove server file.
     $this->assertEquals('true', $upload_test->server('upload_cleanup', 'POST', array('file_path' => $uploaded_file_path)));
     unlink($upload_file_path);
     $this->assertFalse(file_exists($upload_file_path));
     $this->assertFalse(file_exists($uploaded_file_path));
 }
예제 #28
0
 public function seeInDatabase($table, $criteria = [])
 {
     $res = $this->proceedSeeInDatabase($table, "count(*)", $criteria);
     \PHPUnit_Framework_Assert::assertGreaterThan(0, $res);
 }
예제 #29
0
/**
 * Asserts that a value is greater than another value.
 *
 * @param  mixed   $expected
 * @param  mixed   $actual
 * @param  string  $message
 * @since  Method available since Release 3.1.0
 */
function assertGreaterThan($expected, $actual, $message = '')
{
    return PHPUnit_Framework_Assert::assertGreaterThan($expected, $actual, $message);
}
예제 #30
0
 public function toBeGreaterThan($expected)
 {
     \PHPUnit_Framework_Assert::assertGreaterThan($expected, $this->actual);
 }