本文整理汇总了PHP中PHPUnit_Framework_Assert::assertNull方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPUnit_Framework_Assert::assertNull方法的具体用法?PHP PHPUnit_Framework_Assert::assertNull怎么用?PHP PHPUnit_Framework_Assert::assertNull使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPUnit_Framework_Assert
的用法示例。
在下文中一共展示了PHPUnit_Framework_Assert::assertNull方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testPruneOldTransactions
public function testPruneOldTransactions()
{
$tx_helper = app('SampleTransactionsHelper');
$created_txs = [];
for ($i = 0; $i < 5; $i++) {
$created_txs[] = $tx_helper->createSampleTransaction('sample_xcp_parsed_01.json', ['txid' => str_repeat('0', 63) . ($i + 1)]);
}
$tx_repository = app('App\\Repositories\\TransactionRepository');
$created_txs[0]->timestamps = false;
$tx_repository->update($created_txs[0], ['updated_at' => time() - 60], ['timestamps' => false]);
$created_txs[1]->timestamps = false;
$tx_repository->update($created_txs[1], ['updated_at' => time() - 59], ['timestamps' => false]);
$created_txs[2]->timestamps = false;
$tx_repository->update($created_txs[2], ['updated_at' => time() - 5], ['timestamps' => false]);
// prune all
$this->dispatch(new PruneTransactions(50));
// check that all transactions were erased
$tx_repository = app('App\\Repositories\\TransactionRepository');
foreach ($created_txs as $offset => $created_tx) {
$loaded_tx = $tx_repository->findByTXID($created_tx['txid']);
if ($offset < 2) {
PHPUnit::assertNull($loaded_tx, "found unexpected tx: " . ($loaded_tx ? json_encode($loaded_tx->toArray(), 192) : 'null'));
} else {
PHPUnit::assertNotNull($loaded_tx, "missing tx {$offset}");
PHPUnit::assertEquals($created_tx->toArray(), $loaded_tx->toArray());
}
}
}
示例2: testGetEmptyComposedTransactionsByUnknownRequestID
public function testGetEmptyComposedTransactionsByUnknownRequestID()
{
$repository = app('App\\Repositories\\ComposedTransactionRepository');
$request_id = 'unknownreqid01';
// load the empty composed transaction
$loaded_transactions = $repository->getComposedTransactionByRequestID($request_id);
PHPUnit::assertNull($loaded_transactions);
}
示例3: assertLockDiscoveryPropertyNowhere
public function assertLockDiscoveryPropertyNowhere(ezcWebdavMemoryBackend $backend)
{
$prop = $backend->getProperty('/collection', 'lockdiscovery');
PHPUnit_Framework_Assert::assertNull($prop);
$prop = $backend->getProperty('/collection/resource.html', 'lockdiscovery');
PHPUnit_Framework_Assert::assertType('ezcWebdavLockDiscoveryProperty', $prop, 'Property has incorrect type.');
PHPUnit_Framework_Assert::assertEquals(0, count($prop->activeLock), 'Active lock element not removed correctly.');
}
示例4: tearDownAfterClass
/**
* Cleans up the environment after running a test.
*/
public static function tearDownAfterClass()
{
// fwrite(STDOUT, __METHOD__ . "\n");
// Delete User for forum test
self::$userPDO->delete(SELF::USER_ID);
$retUser = self::$userPDO->get(SELF::USER_ID);
PHPUnit_Framework_Assert::assertNull($retUser);
// Delete Test Forum
self::$forumPDO->deleteForum(self::$forumId);
$testForum = self::$forumPDO->getForum(self::$forumId);
PHPUnit_Framework_Assert::assertNull($testForum);
}
示例5: testSetterAndGetter
public function testSetterAndGetter()
{
$user = new UserDefault();
PHPUnit::assertInstanceOf(DateTime::class, $user->getCreatedAt());
PHPUnit::assertInstanceOf(DateTime::class, $user->getUpdatedAt());
PHPUnit::assertNull($user->getDeletedAt());
PHPUnit::assertSame('user', $user->getRole()->getName());
$role = new UserRoleDefault('test');
$user->setRole($role);
PHPUnit::assertSame($role, $user->getRole());
PHPUnit::assertFalse($user->isEnabled());
$user->enable();
PHPUnit::assertTrue($user->isEnabled());
$user->disable();
PHPUnit::assertFalse($user->isEnabled());
}
示例6: testPruneOldBlocks
public function testPruneOldBlocks()
{
$block_helper = app('SampleBlockHelper');
$created_blocks = [];
for ($i = 0; $i < 5; $i++) {
$created_blocks[] = $block_helper->createSampleBlock('default_parsed_block_01.json', ['hash' => str_repeat('0', 63) . ($i + 1), 'height' => 10001 + $i]);
}
// prune last 3
$this->dispatch(new PruneBlocks(3));
$block_repository = app('App\\Repositories\\BlockRepository');
foreach ($created_blocks as $offset => $created_block) {
$loaded_block = $block_repository->findByHash($created_block['hash']);
if ($offset < 2) {
PHPUnit::assertNull($loaded_block, "found unexpected block: " . ($loaded_block ? json_encode($loaded_block->toArray(), 192) : 'null'));
} else {
PHPUnit::assertNotNull($loaded_block, "missing block {$offset}");
PHPUnit::assertEquals($created_block->toArray(), $loaded_block->toArray());
}
}
}
示例7: testExhangeBind
public function testExhangeBind()
{
$ch = $this->prepareAMQPChannel('channel_id');
$con = $this->prepareAMQPConnection();
$source = 'example_source';
$destination = 'example_destination';
$key = 'example_key';
$ch->expects($this->once())->method('exchange_bind')->will($this->returnCallback(function ($d, $s, $k, $n, $a) use($destination, $source, $key) {
\PHPUnit_Framework_Assert::assertSame($destination, $d);
\PHPUnit_Framework_Assert::assertSame($source, $s);
\PHPUnit_Framework_Assert::assertSame($key, $k);
\PHPUnit_Framework_Assert::assertFalse($n);
\PHPUnit_Framework_Assert::assertNull($a);
}));
$binding = $this->getBinding($con, $ch);
$binding->setExchange($source);
$binding->setDestination($destination);
$binding->setRoutingKey($key);
$binding->setDestinationIsExchange(true);
$binding->setupFabric();
}
示例8: test
public function test()
{
$object = new UserDefault();
$type = UserDefault::class;
$metadata = new ObjectMetadata($object);
PHPUnit::assertEquals($type, $metadata->getType());
PHPUnit::assertNotEquals(10, $object->getId());
$metadata->setValue($object, 'id', 10);
PHPUnit::assertEquals(10, $object->getId());
PHPUnit::assertEquals(new \ReflectionClass($object), $metadata->getReflectionClass());
try {
$metadata->getProperty('thisPropertyDoesNotExists', true);
PHPUnit::fail('Must raise an exception');
} catch (\RuntimeException $ex) {
}
$property = $metadata->getProperty('thisPropertyDoesNotExists');
PHPUnit::assertNull($property);
$properties = $metadata->getProperties();
$type = $metadata->getType();
$object = unserialize(serialize($metadata));
PHPUnit::assertEquals($properties, $object->getProperties());
PHPUnit::assertEquals($type, $object->getType());
PHPUnit::assertEquals($metadata, $object);
}
示例9: toBeNull
public function toBeNull()
{
if ($this->negate) {
a::assertNotNull($this->actual);
} else {
a::assertNull($this->actual);
}
}
示例10: assertLockDiscoveryPropertyNowhereElse
public function assertLockDiscoveryPropertyNowhereElse(ezcWebdavMemoryBackend $backend)
{
$prop = $backend->getProperty('/collection', 'lockdiscovery');
PHPUnit_Framework_Assert::assertNull($prop);
}
示例11: dontSeeOptionIsSelected
public function dontSeeOptionIsSelected($select, $text)
{
$option = $this->findSelectedOption($select);
if (!$option) {
\PHPUnit_Framework_Assert::assertNull($option);
return;
}
$this->assertNotEquals($text, $option->getText());
}
示例12: dontSeeHttpHeader
/**
* Checks over the given HTTP header and (optionally)
* its value, asserting that are not there
*
* @param $name
* @param $value
*/
public function dontSeeHttpHeader($name, $value = null)
{
if ($value) {
\PHPUnit_Framework_Assert::assertNotEquals($this->client->getInternalResponse()->getHeader($name), $value);
} else {
\PHPUnit_Framework_Assert::assertNull($this->client->getInternalResponse()->getHeader($name));
}
}
示例13: testBitcoinTransaction
public function testBitcoinTransaction()
{
$parser = new Parser();
$tx_data = $this->getSampleBitcoinTransaction();
$type = $parser->lookupCounterpartyTransactionType($tx_data, 1);
PHPUnit::assertNull($type);
}
示例14: assertion
function assertion($key, $value)
{
$test = new Test();
$test->server('json_response', 'POST', array('key' => $key, 'value' => $value));
$response = $test->curl->response;
PHPUnit_Framework_Assert::assertNotNull($response);
PHPUnit_Framework_Assert::assertNull($response->null);
PHPUnit_Framework_Assert::assertTrue($response->true);
PHPUnit_Framework_Assert::assertFalse($response->false);
PHPUnit_Framework_Assert::assertTrue(is_int($response->integer));
PHPUnit_Framework_Assert::assertTrue(is_float($response->float));
PHPUnit_Framework_Assert::assertEmpty($response->empty);
PHPUnit_Framework_Assert::assertTrue(is_string($response->string));
}
示例15: null
public function null()
{
a::assertNull($this->actual, $this->description);
}