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


PHP assertNotNull函数代码示例

本文整理汇总了PHP中assertNotNull函数的典型用法代码示例。如果您正苦于以下问题:PHP assertNotNull函数的具体用法?PHP assertNotNull怎么用?PHP assertNotNull使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: iShouldNotReachMyRateLimit

 /**
  * @Then /^(?:|I )should not reach my rate limit$/
  */
 public function iShouldNotReachMyRateLimit()
 {
     $remainingCalls = $this->client->getHttpClient()->remainingCalls;
     assertNotNull($remainingCalls);
     assertTrue(5000 > $remainingCalls);
     assertTrue(0 < $remainingCalls);
 }
开发者ID:nickl-,项目名称:php-github-api,代码行数:10,代码来源:FeatureContext.php

示例2: testState

        public function testState()
        {
            assertNull($this->objMath->getFirstOperand());
            assertNull($this->objMath->getSecondOperand());
            assertNull($this->objMath->getFirstOperator());
            assertNull($this->objMath->getSecondOperator());

            assertFalse( $this->objMath->validate() );
            
            $this->objMath->setFirstOperand('5');
            $this->objMath->setFirstOperator('+');
            $this->objMath->setSecondOperand('2');

            assertNotNull($this->objMath->getFirstOperand());
            assertNotNull($this->objMath->getSecondOperand());
            assertNotNull($this->objMath->getFirstOperator());
            assertNotNull($this->objMath->getSecondOperator());

            assertTrue( $this->objMath->validate() );

            $this->objMath->clear( );

            assertNull($this->objMath->getFirstOperand());
            assertNull($this->objMath->getSecondOperand());
            assertNull($this->objMath->getFirstOperator());
            assertNull($this->objMath->getSecondOperator());
            
        }
开发者ID:rdnorthup,项目名称:Hudson-PHP-Integration,代码行数:28,代码来源:EmptyTest.php

示例3: theFileShouldExistInDatabase

 /**
  * Checks that a file (or media) exists in database
  *
  * @param string $originalFilename
  *
  * @Then /^The file with original filename "([^"]*)" should exists in database$/
  */
 public function theFileShouldExistInDatabase($originalFilename)
 {
     $fileInfoRepoClass = $this->getParameter('akeneo_file_storage.model.file_info.class');
     $fileInfoRepository = $this->getRepository($fileInfoRepoClass);
     $fileInfo = $fileInfoRepository->findOneBy(['originalFilename' => $originalFilename]);
     assertNotNull($fileInfo, sprintf('Unable to find file with original filename "%s" in database', $originalFilename));
 }
开发者ID:a2xchip,项目名称:pim-community-dev,代码行数:14,代码来源:FileInfoStorage.php

示例4: iAddTheMailinglistToThePage

 /**
  * @Given /^I add the "([^"]*)" mailinglist to the "([^"]*)" page$/
  */
 public function iAddTheMailinglistToThePage($mailinglistTitle, $pageUrl)
 {
     $mailinglist = \MailingList::get()->filter('Title', $mailinglistTitle)->First();
     assertNotNull($mailinglist, 'Could not find MailingList with ' . $mailinglistTitle);
     $page = \SubscriptionPage::get()->filter('URLSegment', $pageUrl)->First();
     assertNotNull($page);
     $lists = $page->MailingLists ? explode(',', $page->MailingLists) : array();
     $lists[] = $mailinglist->ID;
     $page->MailingLists = implode(',', $lists);
     $page->write();
     $page->publish('Stage', 'Live');
 }
开发者ID:tractorcow,项目名称:silverstripe-newsletter,代码行数:15,代码来源:FeatureContext.php

示例5: _loadUserDataViaOpenSocialApi

 /**
  * Loads user data via open social api
  *
  * @param string $userName
  * @return array $userData
  * @throws Exception in case user cannot be retrieved
  * for testing deprovisioning also
  */
 protected function _loadUserDataViaOpenSocialApi($userName)
 {
     $url = self::TEST_OPEN_SOCIAL_API_URL . self::TEST_IDP_DOMAIN . ':' . $userName . '?fields=all';
     $this->getMainContext()->getSession()->visit($url);
     $userDataJson = $this->getMainContext()->getSession()->getPage()->getContent();
     $statusCode = $this->getMainContext()->getSession()->getStatusCode();
     assertEquals($statusCode, 200, 'Connecting to Open Social API failed with status ' . $statusCode);
     $resultData = json_decode($userDataJson, true);
     $userData = current($resultData['entry']);
     $isUserFound = is_array($userData) && array_key_exists('id', $userData);
     assertNotNull($isUserFound, 'User ' . $userName . ' Could not be retrieved from via Open Social Api');
     return $userData;
 }
开发者ID:newlongwhitecloudy,项目名称:OpenConext-engineblock,代码行数:21,代码来源:Provisioning.php

示例6: iShouldBeAbleToSelectFromTheWayf

 /**
  * @Given /^I should be able to select "([^"]*)" from the WAYF$/
  */
 public function iShouldBeAbleToSelectFromTheWayf($guestIdp)
 {
     $button = $this->getMainContext()->getSession()->getPage()->findButton($guestIdp);
     assertNotNull($button);
 }
开发者ID:newlongwhitecloudy,项目名称:OpenConext-engineblock,代码行数:8,代码来源:TestSp.php

示例7: theCachecontrolHeaderShouldIncludeTheSharedMaxageDirectiveForSharedCaches

 /**
  * @Then the cachecontrol header should include the shared maxage directive for shared caches
  */
 public function theCachecontrolHeaderShouldIncludeTheSharedMaxageDirectiveForSharedCaches()
 {
     $rawCacheControl = $this->getSession()->getResponseHeader('cache-control');
     assertNotNull($rawCacheControl, 'I\'m not able to find the cache-control header!');
     assertContains('s-maxage', $rawCacheControl, 'The cache-control header should include the "s-maxage" directive!');
 }
开发者ID:basuritas-php,项目名称:php.symfony2-http-cache-training,代码行数:9,代码来源:FeatureContext.php

示例8: iShouldSeeAField

 /**
  * @Given /^I should( not? |\s*)see a "([^"]*)" field$/
  */
 public function iShouldSeeAField($negative, $text)
 {
     $page = $this->getSession()->getPage();
     $els = $page->findAll('named', array('field', "'{$text}'"));
     $matchedEl = null;
     foreach ($els as $el) {
         if ($el->isVisible()) {
             $matchedEl = $el;
         }
     }
     if (trim($negative)) {
         assertNull($matchedEl);
     } else {
         assertNotNull($matchedEl);
     }
 }
开发者ID:assertchris,项目名称:silverstripe-framework,代码行数:19,代码来源:CmsFormsContext.php

示例9: iShouldSeeRowsInTheTable

 /**
  * @Then /^I should see (\d+) rows in the table$/
  */
 public function iShouldSeeRowsInTheTable($rows)
 {
     $table = $this->getPage()->find('css', '.main-content table');
     assertNotNull($table, 'Cannot find a table!');
     assertCount(intval($rows), $table->findAll('css', 'tbody tr'));
 }
开发者ID:radvance,项目名称:radvance,代码行数:9,代码来源:WebContext.php

示例10: assertNotNull

<?php

// Get the test nodes
$node = $_ALF_MODEL["testNode"];
assertNotNull($node, "testNode model value was found to be null");
$folder = $_ALF_MODEL["testFolder"];
assertNotNull($folder, "testFolder model value was found to be null");
// Test changing the properties of the node
$node->cm_name = "changed.txt";
$node->cm_author = "Mr Trouble";
// Add aspect
$node->addAspect("cm_titled", array("cm_title" => "my title", "cm_description" => "my description"));
// Remove aspect
$node->removeAspect("cm_versionable");
// Create a child node
$newNode1 = $folder->createChild("cm_content", "cm_contains", "cm_file.txt");
$newNode1->cm_name = "file.txt";
$newNode1->addAspect("sys_referenceable", array());
// Create another child node
$newNode2 = $folder->createChild("cm_folder", "cm_contains", "cm_testFolder");
$newNode2->cm_name = "testFolder";
// Add a non-primary child
$newNode2->addChild($node, "cm_contains", "cm_myNode");
// Associate the two nodes together
$newNode1->addAssociation($newNode2, "cm_references");
// Save the changes made
$_ALF_SESSION->save();
// Check the node have the correct values after the save
assertEquals("changed.txt", $node->cm_name);
assertEquals("Mr Trouble", $node->cm_author);
assertTrue($node->hasAspect("cm_titled"));
开发者ID:negabaro,项目名称:alfresco,代码行数:31,代码来源:testNodeSave.php

示例11: assertEquals

<?php

// Tests the Alfresco debug methods
// TODO figure out how to test the failures ..
assertEquals("value", "value");
assertEquals(1, 1);
$value = new Repository();
assertNotNull($value);
assertTrue(true);
assertFalse(false);
开发者ID:negabaro,项目名称:alfresco,代码行数:10,代码来源:testUnitTestMethods.php

示例12: iScrollToElement

 /**
  * Scroll to a certain element by CSS selector.
  * Requires an "id" attribute to uniquely identify the element in the document.
  *
  * Example: Given I scroll to the ".css_element" element
  *
  * @Given /^I scroll to the "(?P<locator>(?:[^"]|\\")*)" element$/
  */
 public function iScrollToElement($locator)
 {
     $el = $this->getSession()->getPage()->find('css', $locator);
     assertNotNull($el, sprintf('The element "%s" is not found', $locator));
     $id = $el->getAttribute('id');
     if (empty($id)) {
         throw new \InvalidArgumentException('Element requires an "id" attribute');
     }
     $js = sprintf("document.getElementById('%s').scrollIntoView(true);", $id);
     $this->getSession()->executeScript($js);
 }
开发者ID:helpfulrobot,项目名称:silverstripe-behat-extension,代码行数:19,代码来源:BasicContext.php

示例13: theIFillInTheDropdownWith

 /**
  * Workaround for chosen.js dropdowns or tree dropdowns which hide the original dropdown field.
  *
  * @When /^(?:|I )fill in the "(?P<field>(?:[^"]|\\")*)" dropdown with "(?P<value>(?:[^"]|\\")*)"$/
  * @When /^(?:|I )fill in "(?P<value>(?:[^"]|\\")*)" for the "(?P<field>(?:[^"]|\\")*)" dropdown$/
  */
 public function theIFillInTheDropdownWith($field, $value)
 {
     $field = $this->fixStepArgument($field);
     $value = $this->fixStepArgument($value);
     $nativeField = $this->getSession()->getPage()->find('named', array('select', $this->getSession()->getSelectorsHandler()->xpathLiteral($field)));
     if ($nativeField && $nativeField->isVisible()) {
         $nativeField->selectOption($value);
         return;
     }
     // Given the fuzzy matching, we might get more than one matching field.
     $formFields = array();
     // Find by label
     $formField = $this->getSession()->getPage()->findField($field);
     if ($formField && $formField->getTagName() == 'select') {
         $formFields[] = $formField;
     }
     // Fall back to finding by title (for dropdowns without a label)
     if (!$formFields) {
         $formFields = $this->getSession()->getPage()->findAll('xpath', sprintf('//*[self::select][(./@title="%s")]', $field));
     }
     // Find by name (incl. hidden fields)
     if (!$formFields) {
         $formFields = $this->getSession()->getPage()->findAll('xpath', "//*[@name='{$field}']");
     }
     // Find by label
     if (!$formFields) {
         $label = $this->getSession()->getPage()->find('xpath', "//label[.='{$field}']");
         if ($label && ($for = $label->getAttribute('for'))) {
             $formField = $this->getSession()->getPage()->find('xpath', "//*[@id='{$for}']");
             if ($formField) {
                 $formFields[] = $formField;
             }
         }
     }
     assertGreaterThan(0, count($formFields), sprintf('Chosen.js dropdown named "%s" not found', $field));
     // Traverse up to field holder
     $container = null;
     foreach ($formFields as $formField) {
         $container = $this->findParentByClass($formField, 'field');
         if ($container) {
             break;
         }
         // Default to first visible container
     }
     assertNotNull($container, 'Chosen.js field container not found');
     // Click on newly expanded list element, indirectly setting the dropdown value
     $linkEl = $container->find('xpath', './/a[./@href]');
     assertNotNull($linkEl, 'Chosen.js link element not found');
     $this->getSession()->wait(100);
     // wait for dropdown overlay to appear
     $linkEl->click();
     if (in_array('treedropdown', explode(' ', $container->getAttribute('class')))) {
         // wait for ajax dropdown to load
         $this->getSession()->wait(5000, "window.jQuery && " . "window.jQuery('#" . $container->getAttribute('id') . " .treedropdownfield-panel li').length > 0");
     } else {
         // wait for dropdown overlay to appear (might be animated)
         $this->getSession()->wait(300);
     }
     $listEl = $container->find('xpath', sprintf('.//li[contains(normalize-space(string(.)), \'%s\')]', $value));
     if (null === $listEl) {
         throw new \InvalidArgumentException(sprintf('Chosen.js list element with title "%s" not found', $value));
     }
     $listLinkEl = $listEl->find('xpath', './/a');
     if ($listLinkEl) {
         $listLinkEl->click();
     } else {
         $listEl->click();
     }
 }
开发者ID:aaronleslie,项目名称:aaronunix,代码行数:75,代码来源:CmsUiContext.php

示例14: stepPasswordForEmailShouldBe

 /**
  * @Then /^the password for "([^"]*)" should be "([^"]*)"$/
  */
 public function stepPasswordForEmailShouldBe($id, $password)
 {
     $member = \Member::get()->filter('Email', $id)->First();
     assertNotNull($member);
     assertTrue($member->checkPassword($password)->valid());
 }
开发者ID:jeffreyguo,项目名称:silverstripe-behat-extension,代码行数:9,代码来源:LoginContext.php

示例15: assertNotNull

<?php

// Tests the global values set my the script/template engine, both those added by the
// engine and those added from the model
// Check the repository value
assertNotNull($_ALF_REPOSITORY, "_ALF_REPOSITORY was found to be null");
$newSession = $_ALF_REPOSITORY->createSession();
assertNotNull($newSession, "newSession was found to be null");
// Check the session value
assertNotNull($_ALF_SESSION, "_ALF_SESSION was found to be null");
assertNotNull($_ALF_SESSION->stores);
assertNotNull($_ALF_SESSION->ticket);
// Check that the model is present
assertNotNull($_ALF_MODEL, "_ALF_MODEL was found to be null");
// Check the node value set in the model and passed through
assertNotNull($_ALF_MODEL["testNode"], "testNode was found to be null");
assertEquals($_ALF_MODEL["nodeId"], $_ALF_MODEL["testNode"]->id);
// Check the store ref value passed through
assertNotNull($_ALF_MODEL["testStore"], "testStore was found to be null");
assertEquals($_ALF_MODEL["storeId"], $_ALF_MODEL["testStore"]->address);
// Check the other values set in the model
assertEquals("testString", $_ALF_MODEL["testString"]);
assertEquals(1.0, $_ALF_MODEL["testNumber"]);
开发者ID:negabaro,项目名称:alfresco,代码行数:23,代码来源:testModelAndGlobals.php


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