false() public static method

Checks FALSE assertion.
public static false ( $actual, $description = NULL ) : void
return void
 /**
  * @param IComparable $five
  * @param IComparable $six
  */
 public function assertForComparison(IComparable $five, IComparable $six)
 {
     Assert::true($five->isLessThan($six));
     Assert::true($five->isLessThanOrEqual($six));
     Assert::false($six->isLessThan($five));
     Assert::false($six->isLessThanOrEqual($five));
     Assert::false($five->isEqual($six));
     Assert::false($six->isEqual($five));
 }
示例#2
0
 public function testIsSingleValuedAssociation()
 {
     $metadata = $this->getMetadataFor('User');
     Assert::true($metadata->isSingleValuedAssociation('address'));
     Assert::false($metadata->isSingleValuedAssociation('articles'));
     Assert::false($metadata->isSingleValuedAssociation('groups'));
     Assert::exception(function () use($metadata) {
         $metadata->isSingleValuedAssociation('name');
     }, 'NForms\\Exceptions\\MetadataException');
     Assert::exception(function () use($metadata) {
         $metadata->isSingleValuedAssociation('invalid');
     }, 'NForms\\Exceptions\\MetadataException');
     $metadata = $this->getMetadataFor('Group');
     Assert::false($metadata->isSingleValuedAssociation('users'));
     Assert::exception(function () use($metadata) {
         $metadata->isSingleValuedAssociation('name');
     }, 'NForms\\Exceptions\\MetadataException');
     Assert::exception(function () use($metadata) {
         $metadata->isSingleValuedAssociation('invalid');
     }, 'NForms\\Exceptions\\MetadataException');
     $metadata = $this->getMetadataFor('Article');
     Assert::true($metadata->isSingleValuedAssociation('author'));
     Assert::exception(function () use($metadata) {
         $metadata->isSingleValuedAssociation('title');
     }, 'NForms\\Exceptions\\MetadataException');
     Assert::exception(function () use($metadata) {
         $metadata->isSingleValuedAssociation('invalid');
     }, 'NForms\\Exceptions\\MetadataException');
     $metadata = $this->getMetadataFor('Address');
     Assert::true($metadata->isSingleValuedAssociation('user'));
     Assert::exception(function () use($metadata) {
         $metadata->isSingleValuedAssociation('street');
     }, 'NForms\\Exceptions\\MetadataException');
     Assert::exception(function () use($metadata) {
         $metadata->isSingleValuedAssociation('invalid');
     }, 'NForms\\Exceptions\\MetadataException');
 }
示例#3
0
 protected function checkAjaxForm($destination, $formName, $post = [], $path = FALSE)
 {
     if (is_string($path)) {
         $this->checkForm($destination, $formName, $post, $path);
         Assert::false($this->__testbench_presenter->isAjax());
     }
     $this->__testbench_presenter = NULL;
     //FIXME: not very nice, but performance first
     $this->__testbench_ajaxMode = TRUE;
     $response = $this->check($destination, ['do' => $formName . '-submit'], $post);
     Assert::true($this->__testbench_presenter->isAjax());
     if (!$this->__testbench_exception) {
         Assert::same(200, $this->getReturnCode());
         Assert::type('Nette\\Application\\Responses\\JsonResponse', $response);
     }
     $this->__testbench_presenter = NULL;
     $this->__testbench_ajaxMode = FALSE;
     return $response;
 }
示例#4
0
 /**
  * @Then /^neu?vidím (komponentu|stránku) (.+)$/
  */
 public function wontSeeComponent($type, $componentName)
 {
     $page = $this->getCurrentPage();
     switch ($type) {
         case 'komponentu':
             if ($page instanceof ComponentElement) {
                 // mam primo komponentu
                 Assert::false($componentName === $page->getName());
             } elseif ($page instanceof PageElement) {
                 if ($page->tryFindComponent($componentName)) {
                     Assert::fail("Komponenta '{$componentName}' byla nalezena");
                 }
             } else {
                 throw new Nette\InvalidStateException();
             }
             break;
         case 'stránku':
             if ($page instanceof ComponentElement) {
                 Assert::fail("Expected page, component");
             }
             Assert::false($componentName === $page->getName());
             break;
         default:
             throw new \InvalidArgumentException();
     }
 }
 private function testValid()
 {
     $file = $this->sniffer->processFile(Tester::$setup['invalidDir'] . $this->testedFile->getName() . '.php');
     $errors = $file->getErrors();
     Assert::false(empty($errors));
 }
示例#6
0
<?php

use Tester\Assert;
require_once __DIR__ . "/../vendor/autoload.php";
require_once __DIR__ . "/Token.php";
//valid value
$value = str_repeat('BeerNowThere0sATemporarySolution', 2);
$tokenFoo = new Token($value);
Assert::same("BeerNowThere0sATemporarySolutionBeerNowThere0sATemporarySolution", $tokenFoo->getValue());
//compare with another object of same value
$tokenBar = new Token("BeerNowThere0sATemporarySolutionBeerNowThere0sATemporarySolution");
$areSame = $tokenBar->sameValueAs($tokenFoo);
Assert::true($areSame);
//compare with another object of different value
$value = str_repeat('CraftBeerLovers0', 4);
//
$tokenPub = new Token($value);
Assert::same("CraftBeerLovers0CraftBeerLovers0CraftBeerLovers0CraftBeerLovers0", $tokenPub->getValue());
$areSame = $tokenPub->sameValueAs($tokenBar);
Assert::false($areSame);
//invalid values
Assert::exception(function () {
    new Token(null);
}, InvalidArgumentException::class, "Token must be not empty");
Assert::exception(function () {
    new Token("InvalidTokenLength123456789");
}, InvalidArgumentException::class, "Token must be 64 characters long");
Assert::exception(function () {
    $value = str_repeat('?!@#$%^&', 8);
    new Token($value);
}, InvalidArgumentException::class, "Token must be valid base_64");
示例#7
0
Assert::equal('z', $m[new Keyword('abc')]);
Assert::true(isset($m[1]));
Assert::true(isset($m[new Keyword('abc')]));
// set
$s = new Set(['a']);
Assert::exception(function () use($s) {
    $s->add('a');
}, 'transit\\TransitException');
Assert::true($s->contains('a'));
$s->add(new Keyword('abc'));
$s->add('b');
$s->add(true);
Assert::equal(['a', new Keyword('abc'), 'b', true], $s->toArray());
$s->remove(new Keyword('abc'));
Assert::equal(['a', 'b', true], $s->toArray());
Assert::false($s->contains(new Keyword('abc')));
Assert::true($s->contains('a'));
Assert::true($s->contains('b'));
Assert::true($s->contains(true));
//-------------------------
class Point
{
    public $x;
    public $y;
    public function __construct($x, $y)
    {
        $this->x = $x;
        $this->y = $y;
    }
}
class Circle
示例#8
0
文件: MenuTest.php 项目: h4kuna/menu
$menu->setActiveItem(ACTIVE_INDEX);
$foo = $menu->getActiveItem();
Assert::equal(ACTIVE_INDEX, $foo->getIndex());
// check node is active or inactive ********************************************
/* @var $node Menu\Node\Item */
foreach ($menu->getIndexes() as $node) {
    $_index = $node->getIndex();
    if ($_index == ACTIVE_INDEX) {
        Assert::true($menu->isActive($node));
    } else {
        Assert::false($menu->isActive($node));
    }
    if (preg_match('~^' . $_index . '~', ACTIVE_INDEX)) {
        Assert::true($menu->isInActive($menu->findByIndex($_index)));
    } else {
        Assert::false($menu->isInActive($menu->findByIndex($_index)));
    }
}
// check bread crumb navigation ************************************************
foreach ($menu->getCrumbNavigation() as $node) {
    $_index = $node->getIndex();
    Assert::true((bool) preg_match('~^' . $_index . '~', ACTIVE_INDEX));
}
Assert::equal(ACTIVE_INDEX, $_index);
/**
 * RECURSIVE RENDER ************************************************************
 * *****************************************************************************
 */
Assert::matchFile(__DIR__ . '/data/menu.html', buildHtmlRecursiveMenu($menu));
/**
 * CYCLE RENDER ****************************************************************