コード例 #1
0
        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());
            
        }
コード例 #2
0
ファイル: PageManagerTest.php プロジェクト: alpas29/cms
 public function test_it_destroys_page()
 {
     $this->RoutesGenerator->shouldReceive('cacheRoutes')->once();
     $this->PageManager->destroyPage(1);
     $deletedPage = \DvsPage::find(1);
     assertNull($deletedPage);
 }
コード例 #3
0
 public function test_it_can_recover_password()
 {
     $input = ['_token' => 'someFooTokenJASdad', 'email' => '*****@*****.**'];
     $this->Framework->Password->shouldReceive('sendResetLink')->andReturn('passwords.sent');
     // check null is returned
     assertNull($this->SessionsRepository->recoverPassword($input));
     // check SessionsRepo messages attribute equals string
     assertEquals('Recovery email has been sent.', $this->SessionsRepository->message);
 }
コード例 #4
0
 /**
  * @test
  * @covers Mobileka\ScopeApplicator\Yii2\InputManager::get
  */
 public function gets_value_from_user_input()
 {
     $im = new Mobileka\ScopeApplicator\Yii2\InputManager();
     assertNull($im->get('param'));
     assertSame('no such param', $im->get('param', 'no such param'));
     // add something to request parameters
     $im->setQueryParams(['param' => 'hello']);
     assertEquals('hello', $im->get('param'));
 }
コード例 #5
0
 /**
  * @test
  * @covers Mobileka\ScopeApplicator\Laravel\InputManager::get
  */
 public function gets_value_from_user_input()
 {
     $lim = new Mobileka\ScopeApplicator\Laravel\InputManager();
     assertNull($lim->get('param'));
     assertSame('no such param', $lim->get('param', 'no such param'));
     // add something to request parameters
     $lim->inputManager->query->set('param', 'hello');
     assertEquals('hello', $lim->get('param'));
 }
コード例 #6
0
 public function testInteraction()
 {
     // --- test behavior
     // notice we use separate objects the two, we just want to test similar behavior
     // not interaction
     $details = new CustomerDetail();
     $source = Datasource::make(new CustomerDetail());
     $source['biography'] = 'A nice life!';
     $source['accepts_cookies'] = 0;
     // eloquent always report false, datasource will report false or true
     assertFalse(isset($details->customer));
     assertFalse(isset($source['customer']));
     assertNull($details->customer);
     assertNull($source['customer']);
 }
コード例 #7
0
ファイル: HasOneTest.php プロジェクト: tacone/datasource
 public function testInteraction()
 {
     // --- test behavior
     // notice we use separate objects the two, we just want to test similar behavior
     // not interaction
     $customer = new Customer();
     $source = Datasource::make(new Customer());
     $source['name'] = 'Frank';
     $source['surname'] = 'Sinatra';
     // eloquent always report false, datasource will report false or true
     assertFalse(isset($customer->details));
     assertFalse(isset($source['details']));
     assertNull($customer->details);
     assertNull($source['details']);
 }
コード例 #8
0
 public function testUnset()
 {
     $this->createModels(Order::class, $array = [['code' => 'a1', 'shipping' => 'home', 'customer_id' => 1], ['code' => 'b1', 'shipping' => 'office', 'customer_id' => 1]]);
     $collection = Order::all();
     $source = DataSource::make($collection);
     assertInstanceOf(Order::class, $source[0]);
     assertInstanceOf(Order::class, $source[1]);
     assertInstanceOf(Order::class, $collection[0]);
     assertInstanceOf(Order::class, $collection[1]);
     unset($source[0]);
     assertNull($source[0]);
     assertInstanceOf(Order::class, $source[1]);
     assertTrue(!isset($collection[0]));
     assertInstanceOf(Order::class, $collection[1]);
     unset($source[1]);
     assertNull($source[1]);
     assertTrue(!isset($collection[1]));
 }
コード例 #9
0
 /**
  * @Given /^there should (not |)be an email (to|from) "([^"]*)" titled "([^"]*)"$/
  */
 public function thereIsAnEmailFromToTitled($negate, $direction, $email, $subject)
 {
     $to = $direction == 'to' ? $email : null;
     $from = $direction == 'from' ? $email : null;
     $match = $this->mailer->findEmail($to, $from, $subject);
     $allMails = $this->mailer->findEmails($to, $from);
     $allTitles = $allMails ? '"' . implode('","', array_map(function ($email) {
         return $email->Subject;
     }, $allMails)) . '"' : null;
     if (trim($negate)) {
         assertNull($match);
     } else {
         $msg = sprintf('Could not find email %s "%s" titled "%s".', $direction, $email, $subject);
         if ($allTitles) {
             $msg .= ' Existing emails: ' . $allTitles;
         }
         assertNotNull($match, $msg);
     }
     $this->lastMatchedEmail = $match;
 }
コード例 #10
0
 /**
  * @test
  */
 public function firstReturnsNullForEmptyInput()
 {
     assertNull(Sequence::of([])->first());
 }
コード例 #11
0
 function test_connect()
 {
     $db = new DB();
     assertNull($db->db);
 }
コード例 #12
0
ファイル: BaseMinkContext.php プロジェクト: kingsj/core
 /**
  * Checks, that element with specified CSS doesn't exist on page.
  *
  * @Then /^(?:|I )should not see an? "(?P<element>[^"]*)" element$/
  */
 public function assertElementNotOnPage($element)
 {
     try {
         assertNull($this->getSession()->getPage()->find('css', $element));
     } catch (AssertException $e) {
         $message = sprintf('An element matching css "%s" appears on this page, but it should not.', $element);
         throw new ExpectationException($message, $this->getSession(), $e);
     }
 }
コード例 #13
0
 /**
  * @covers Mobileka\MosaicArray\MosaicArray::pregValues
  */
 public function test_gets_an_array_of_target_arrays_values_matching_a_regex()
 {
     $target = ['key' => 'VALUE', 'hello' => 'World', 'Mosaic' => 'Soft'];
     $ma = new MosaicArray($target);
     // should not be found
     $result = $ma->pregValues('/^\\d{5}$/');
     assertNull($result);
     $expect = 'Mosaic Soft';
     $result = $ma->pregValues('/^\\d{5}$/', 'Mosaic Soft');
     assertEquals($expect, $result);
     $expect = ['World', 'Soft'];
     $result = $ma->pregValues('/^.*o.*$/');
     assertEquals($expect, $result);
     $expect = ['VALUE'];
     $result = $ma->pregValues('/^.*ALU.*$/');
     assertEquals($expect, $result);
 }
コード例 #14
0
 /**
  * @Then /^I should not be able to select "([^"]*)" from the WAYF$/
  */
 public function iShouldNotBeAbleToSelectFromTheWayf($behavIdp)
 {
     $button = $this->getMainContext()->getSession()->getPage()->findButton($behavIdp);
     assertNull($button);
 }
コード例 #15
0
ファイル: WebUser.php プロジェクト: a2xchip/pim-community-dev
 /**
  * @Then /^I should not see the "([^"]*)" tab$/
  */
 public function iShouldNotSeeTheTab($tab)
 {
     assertNull($this->getCurrentPage()->getFormTab($tab));
 }
コード例 #16
0
ファイル: testFileFolder.php プロジェクト: negabaro/alfresco
$_ALF_SESSION->save();
echo "sub folder node: " . $subFolder->__toString();
assertEquals("mySubFolder", $subFolder->cm_name);
assertEquals($folder, $subFolder->primaryParent);
assertEquals(2, count($folder->children));
// Create file
$subFile = $folder->createFile("mytestFile1.txt");
assertNotNull($subFile, "sub file should not be null");
assertEquals("mytestFile1.txt", $subFile->cm_name);
assertEquals($folder, $subFile->primaryParent);
assertNull($subFile->cm_content, "cm_content should be null");
assertEquals(3, count($folder->children));
$_ALF_SESSION->save();
assertEquals("mytestFile1.txt", $subFile->cm_name);
assertEquals($folder, $subFile->primaryParent);
assertNull($subFile->cm_content, "after save cm_content should not be null");
assertEquals(3, count($folder->children));
// Create file with content
$subFile2 = $folder->createFile("mytestFile2.txt");
assertNotNull($subFile2, "subFile2 should not be null");
$subFile2->updateContent("cm_content", "text/plain", "UTF-8", "12345");
assertEquals("mytestFile2.txt", $subFile2->cm_name);
assertEquals($folder, $subFile2->primaryParent);
assertNotNull($subFile2->cm_content, "cm_content should not be be null before save");
assertEquals("text/plain", $subFile2->mimetype);
assertEquals("UTF-8", $subFile2->encoding);
assertEquals("12345", $subFile2->content);
assertEquals(4, count($folder->children));
$_ALF_SESSION->save();
assertEquals("mytestFile2.txt", $subFile2->cm_name);
assertEquals($folder, $subFile2->primaryParent);
コード例 #17
0
<?php

// Get the test nodes
$folder = $_ALF_MODEL["testFolder"];
assertNotNull($folder, "testFolder model value was found to be null");
$node = $folder->createChild("cm_content", "cm_contains", "cm_myFile.txt");
$node->cm_name = "myFile.txt";
$contentData = $node->cm_content;
assertNull($contentData, "No content data has been set so should be null");
$contentData2 = $node->updateContent("cm_content", "text/plain", "UTF-8", null);
assertNotNull($contentData2, "The newly created content data is unexpectedly null");
assertEquals("text/plain", $contentData2->mimetype);
assertEquals("UTF-8", $contentData2->encoding);
assertNull($contentData2->content);
$contentData2->content = "this is some content";
$contentData3 = $node->cm_content;
assertNotNull($contentData3, "content data 3 was null");
assertEquals("this is some content", $contentData3->content, "content was incorrect before save");
$_ALF_SESSION->save();
$contentData4 = $node->cm_content;
assertNotNull($contentData4, "content data 4 was null");
assertEquals("this is some content", $contentData4->content, "content was incorrect after save");
コード例 #18
0
ファイル: UserManagerTest.php プロジェクト: alpas29/cms
 public function test_it_can_generate_activate_code()
 {
     $user = $this->retrieveValidUserInstance();
     assertNull($this->UserManager->generateActivateCode($user));
 }
コード例 #19
0
 /**
  * @param string $attribute
  * @param string $products
  * @param string $filename
  *
  * @Given /^the file "([^"]*)" of products? (.*) should be "([^"]*)"$/
  */
 public function theFileOfShouldBe($attribute, $products, $filename)
 {
     $this->clearUOW();
     foreach ($this->listToArray($products) as $identifier) {
         $productValue = $this->getProductValue($identifier, strtolower($attribute));
         $media = $productValue->getMedia();
         if ('' === trim($filename)) {
             if ($media) {
                 assertNull($media->getOriginalFilename());
             }
         } else {
             assertEquals($filename, $media->getOriginalFilename());
         }
     }
 }
コード例 #20
0
ファイル: testNode.php プロジェクト: negabaro/alfresco
// Get all properties
$properties = $node->properties;
assertNotNull($properties);
echo "Properties:\n";
foreach ($properties as $fullName => $value) {
    echo "   - " . $fullName . "=>" . $value . "\n";
}
assertEquals("testNode.txt", $properties["{http://www.alfresco.org/model/content/1.0}name"]);
assertEquals("Roy Wetherall", $properties["{http://www.alfresco.org/model/content/1.0}author"]);
// TODO checks on nodeRefs, dates, etc ....
// Check the dynamic property read
assertEquals("testNode.txt", $node->cm_name);
assertEquals("Roy Wetherall", $node->cm_author);
assertNull($node->cm_junk);
assertNull($node->junk);
assertNull($node->cm_title);
// Check the system properties
assertNotNull($node->sys_node_dbid);
assertNotNull($node->sys_node_uuid);
assertNotNull($node->sys_store_identifier);
// Check aspects and hasAspect
$aspects = $node->aspects;
assertNotNull($aspects);
echo "Aspects: \n";
foreach ($aspects as $aspect) {
    echo "   - " . $aspect . "\n";
}
assertTrue($node->hasAspect("{http://www.alfresco.org/model/content/1.0}versionable"));
assertTrue($node->hasAspect("{http://www.alfresco.org/model/content/1.0}classifiable"));
assertTrue($node->hasAspect("cm_versionable"));
assertTrue($node->hasAspect("cm_classifiable"));
コード例 #21
0
ファイル: PagesRespositoryTest.php プロジェクト: alpas29/cms
 public function test_it_does_not_get_live_page_version_by_cookie_when_not_set()
 {
     $page = \DvsPage::find(1);
     $version = $this->PagesRepository->getLivePageVersionByCookie($page);
     assertNull($version);
 }
コード例 #22
0
 /**
  * @test
  */
 public function closeDoesNothing()
 {
     assertNull($this->memoryInputStream->close());
 }
コード例 #23
0
 /**
  * @test
  * @since  8.0.0
  */
 public function parseReturnsNullWhenNoValueForRequestedNameExists()
 {
     assertNull($this->createAnnotation(['foo' => 303])->parse('bar')->asInt());
 }
コード例 #24
0
 /**
  * @test
  */
 public function valueWithoutDefaultValueReturnsNullIfSectionDoesNotExist()
 {
     assertNull($this->properties->value('doesNotExist', 'any'));
 }
コード例 #25
0
ファイル: UriTest.php プロジェクト: stubbles/stubbles-peer
 /**
  * @test
  */
 public function fragmentIsNullIfNotInUri()
 {
     assertNull(Uri::fromString('http://example.org/?wsdl')->fragment());
 }
コード例 #26
0
 /**
  * @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);
     }
 }
コード例 #27
0
 /**
  * @Then /^the "([^"]*)" table should not contain "([^"]*)"$/
  */
 public function theTableShouldNotContain($selector, $text)
 {
     $table = $this->getTable($selector);
     $element = $table->find('named', array('content', "'{$text}'"));
     assertNull($element, sprintf('Element containing `%s` not found in `%s` table', $text, $selector));
 }
コード例 #28
0
 /**
  * @test(expectedFail=true)
  * @profile(fork)
  */
 public function testAssertNullFailed()
 {
     assertNull(true);
 }
コード例 #29
0
 /**
  * @When /^I should (not |)see a "([^"]*)" CMS tab$/
  */
 public function iShouldSeeACmsTab($negate, $tab)
 {
     $this->getSession()->wait(5000, "window.jQuery && window.jQuery('.ui-tabs-nav').size() > 0");
     $page = $this->getSession()->getPage();
     $tabsets = $page->findAll('css', '.ui-tabs-nav');
     assertNotNull($tabsets, 'CMS tabs not found');
     $tab_element = null;
     foreach ($tabsets as $tabset) {
         $tab_element = $tabset->find('named', array('link_or_button', "'{$tab}'"));
         if ($tab_element) {
             break;
         }
     }
     if ($negate) {
         assertNull($tab_element, sprintf('%s tab found', $tab));
     } else {
         assertNotNull($tab_element, sprintf('%s tab not found', $tab));
     }
 }
コード例 #30
0
ファイル: FactoryTest.php プロジェクト: Rotron/laravel5-shop
 /** @test */
 public function relationship_overrides_are_ignored_if_the_relationship_is_not_actually_defined()
 {
     $comment = TestDummy::create('Comment', ['post_id' => 1, 'post_id.title' => 'override']);
     assertNull($comment->post);
     assertNull($comment->getAttribute('post_id.title'));
 }