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


PHP LimeTest::isnt方法代码示例

本文整理汇总了PHP中LimeTest::isnt方法的典型用法代码示例。如果您正苦于以下问题:PHP LimeTest::isnt方法的具体用法?PHP LimeTest::isnt怎么用?PHP LimeTest::isnt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在LimeTest的用法示例。


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

示例1: getFooBarService

        return $this->__bar;
    }
    protected function getFooBarService()
    {
        return $this->__foo_bar;
    }
    protected function getFoo_BazService()
    {
        return $this->__foo_baz;
    }
}
$sc = new ProjectServiceContainer();
$t->is(spl_object_hash($sc->getService('bar')), spl_object_hash($sc->__bar), '->getService() looks for a getXXXService() method');
$t->ok($sc->hasService('bar'), '->hasService() returns true if the service has been defined as a getXXXService() method');
$sc->setService('bar', $bar = new stdClass());
$t->isnt(spl_object_hash($sc->getService('bar')), spl_object_hash($bar), '->getService() prefers to return a service defined with a getXXXService() method than one defined with setService()');
try {
    $sc->getService('baba');
    $t->fail('->getService() thrown an \\InvalidArgumentException if the service does not exist');
} catch (\InvalidArgumentException $e) {
    $t->pass('->getService() thrown an \\InvalidArgumentException if the service does not exist');
}
try {
    $sc->baba;
    $t->fail('->__get() thrown an \\InvalidArgumentException if the service does not exist');
} catch (\InvalidArgumentException $e) {
    $t->pass('->__get() thrown an \\InvalidArgumentException if the service does not exist');
}
try {
    unset($sc->baba);
    $t->fail('->__unset() thrown an LogicException if you try to remove a service');
开发者ID:pablosik,项目名称:symfony,代码行数:31,代码来源:ContainerTest.php

示例2: get

    }
    public function get()
    {
        return $this->foo;
    }
}
// @Before
$paramHolder = new Sonata_ParameterHolder();
$paramHolder->add($params = array('foo' => 42, 'bar' => 4711, 'baz' => new Foo()));
// @After
unset($paramHolder);
unset($params);
// @Test: ->add()
$t->is($paramHolder->getAll(), $params, 'All parameters were added correctly');
$paramHolder->add(null);
$t->isnt($paramHolder->getAll(), null, 'Nothing is added if NULL was given');
$paramHolder->add(array());
$t->isntSame($paramHolder->getAll(), array(), 'Nothing is added if an empty array was given');
$paramHolder->add('this fails');
$t->isnt($paramHolder->getAll(), 'this fails', 'Nothing is added if parameter isn\'t an array');
// @Test: ->get()
$foo = $paramHolder->get('foo');
$t->is($foo, 42, 'The value is retrieved correctly');
$rex = $paramHolder->get('rex');
$t->is($rex, null, 'NULL is returned if the parameter could not be found');
$rex = $paramHolder->get('rex', 'fido');
$t->is($rex, 'fido', 'If a default value is given for a non-existing parameter, the default value is returned');
// @Test: ->getNames()
$t->same($paramHolder->getNames(), array('foo', 'bar', 'baz'), 'All parameter names are retrieved correctly');
// @Test: ->has()
$t->is($paramHolder->has('foo'), true, 'TRUE is returned if the parameter exists');
开发者ID:b00giZm,项目名称:sonata-framework,代码行数:31,代码来源:Sonata_ParameterHolderTest.php

示例3: array

// @Test: ->getStatusCode()
$t->is($res->getStatusCode(), 200, 'Returns HTTP status code 200 per default');
// @Test: ->getStatusText()
$t->is($res->getStatusText(), 'OK', 'Returns HTTP status text \'OK\' per default');
// @Test: ->setStatusCode()
$res->setStatusCode(404);
$t->is($res->getStatusCode(), 404, 'Sets HTTP status code correctly');
$t->is($res->getStatusText(), 'Not Found', 'If no status text is given the default text is returned');
$res->setStatusCode(666, 'Some random shit');
$t->is($res->getStatusText(), 'Some random shit', 'If status text is given it will be returned correctly');
// @Test: ->setFormat()
$res->setFormat('json');
$t->is($res->getFormat(), 'json', 'The format was set correctly');
$t->is($res->getMimeType(), 'application/json', 'The mime type was set correctly, too');
$res->setFormat('foo');
$t->isnt($res->getFormat(), 'foo', 'The format is not set if no matching format/mime type can be found');
// @Test: ::registerMimeType()
Sonata_Response::registerMimeType('foo', 'application/foo');
$res->setFormat('foo');
$t->is($res->getFormat(), 'foo', 'After registering a new format/mime type, the format can be set to it');
$t->is($res->getMimeType(), 'application/foo', 'The mime type was set correctly, too');
Sonata_Response::registerMimeType('html', 'application/bar');
$res->setFormat('html');
$t->isnt($res->getMimeType(), 'application/bar', 'Existing mime type cannot be altered');
// @Test: ->addHeader()
$res->addHeader('Content-type', 'text/xml');
$t->is($res->getHeaders(), array('Content-type' => 'text/xml'), 'The header was added correctly to the headers array');
$res->addHeader('Content-encoding', 'utf-8');
$t->is($res->getHeaders(), array('Content-type' => 'text/xml', 'Content-encoding' => 'utf-8'), 'A second one, too');
// @Test: ->appendToBody()
$res->appendToBody('Hello World.');
开发者ID:b00giZm,项目名称:sonata-framework,代码行数:31,代码来源:Sonata_ResponseTest.php


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