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()); }
public function test_it_destroys_page() { $this->RoutesGenerator->shouldReceive('cacheRoutes')->once(); $this->PageManager->destroyPage(1); $deletedPage = \DvsPage::find(1); assertNull($deletedPage); }
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); }
/** * @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')); }
/** * @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')); }
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']); }
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']); }
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])); }
/** * @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; }
/** * @test */ public function firstReturnsNullForEmptyInput() { assertNull(Sequence::of([])->first()); }
function test_connect() { $db = new DB(); assertNull($db->db); }
/** * 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); } }
/** * @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); }
/** * @Then /^I should not be able to select "([^"]*)" from the WAYF$/ */ public function iShouldNotBeAbleToSelectFromTheWayf($behavIdp) { $button = $this->getMainContext()->getSession()->getPage()->findButton($behavIdp); assertNull($button); }
/** * @Then /^I should not see the "([^"]*)" tab$/ */ public function iShouldNotSeeTheTab($tab) { assertNull($this->getCurrentPage()->getFormTab($tab)); }
$_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);
<?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");
public function test_it_can_generate_activate_code() { $user = $this->retrieveValidUserInstance(); assertNull($this->UserManager->generateActivateCode($user)); }
/** * @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()); } } }
// 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"));
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); }
/** * @test */ public function closeDoesNothing() { assertNull($this->memoryInputStream->close()); }
/** * @test * @since 8.0.0 */ public function parseReturnsNullWhenNoValueForRequestedNameExists() { assertNull($this->createAnnotation(['foo' => 303])->parse('bar')->asInt()); }
/** * @test */ public function valueWithoutDefaultValueReturnsNullIfSectionDoesNotExist() { assertNull($this->properties->value('doesNotExist', 'any')); }
/** * @test */ public function fragmentIsNullIfNotInUri() { assertNull(Uri::fromString('http://example.org/?wsdl')->fragment()); }
/** * @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); } }
/** * @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)); }
/** * @test(expectedFail=true) * @profile(fork) */ public function testAssertNullFailed() { assertNull(true); }
/** * @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)); } }
/** @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')); }