本文整理汇总了PHP中PHPUnit_Framework_Assert::assertNotNull方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPUnit_Framework_Assert::assertNotNull方法的具体用法?PHP PHPUnit_Framework_Assert::assertNotNull怎么用?PHP PHPUnit_Framework_Assert::assertNotNull使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPUnit_Framework_Assert
的用法示例。
在下文中一共展示了PHPUnit_Framework_Assert::assertNotNull方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: assertCommonCacheCollectedData
protected function assertCommonCacheCollectedData(CacheCollectedData $expected, CacheCollectedData $actual)
{
Assert::assertEquals($expected->getData(), $actual->getData());
Assert::assertNotNull($actual->getDuration());
Assert::assertEquals($expected->getProviderId(), $actual->getProviderId());
Assert::assertEquals($expected->getType(), $actual->getType());
}
示例2: assertDestinationCorrect
public function assertDestinationCorrect(ezcWebdavMemoryBackend $backend)
{
PHPUnit_Framework_Assert::assertTrue($backend->nodeExists('/other_collection/moved_resource.html'));
$prop = $backend->getProperty('/other_collection/moved_resource.html', 'lockdiscovery');
PHPUnit_Framework_Assert::assertNotNull($prop, 'Lock discovery property not available on destination.');
PHPUnit_Framework_Assert::assertEquals(0, count($prop->activeLock), 'Active lock available on destination.');
}
示例3: iSyncMostRecentPostsFromTheCategory
/**
* @Given /^I sync (\d+) most recent posts from the category sitemap "([^"]*)"$/
*/
public function iSyncMostRecentPostsFromTheCategory($numberOfPosts, $categorySitemap)
{
$importResponse = Sync::importCategory($categorySitemap, $numberOfPosts);
Assert::assertNotNull($importResponse);
Assert::assertEquals($numberOfPosts, count($importResponse->posts));
Assert::assertTrue(isset($importResponse->posts[0]->id));
}
示例4: 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());
}
}
}
示例5: assertDataPersisted
/**
* @inheritdoc
*/
public function assertDataPersisted($name, array $data)
{
$alias = $this->convertNameToAlias($this->singularize($name));
$class = $this->getEntityManager()->getClassMetadata($alias)->getName();
$found = [];
foreach ($data as $row) {
$criteria = $this->applyMapping($this->getFieldMapping($class), $row);
$criteria = $this->rowToEntityData($class, $criteria, false);
$jsonArrayFields = $this->getJsonArrayFields($class, $criteria);
$criteria = array_diff_key($criteria, $jsonArrayFields);
$entity = $this->getEntityManager()->getRepository($class)->findOneBy($criteria);
Assert::assertNotNull($entity, sprintf('The repository should find data of type "%s" with these criteria: %s', $alias, json_encode($criteria)));
if (!empty($jsonArrayFields)) {
// refresh json fields as they may have changed beforehand
$this->getEntityManager()->refresh($entity);
// json array fields can not be matched by the ORM (depends on driver and requires driver-specific operators),
// therefore we need to check these separately
$accessor = PropertyAccess::createPropertyAccessor();
foreach ($jsonArrayFields as $field => $value) {
Assert::assertSame($value, $accessor->getValue($entity, $field));
}
}
$found[] = $entity;
}
return $found;
}
示例6: assertTargetStillLocked
public function assertTargetStillLocked(ezcWebdavMemoryBackend $backend)
{
$prop = $backend->getProperty('/collection/resource.html', 'lockdiscovery');
PHPUnit_Framework_Assert::assertNotNull($prop, 'Lock discovery property removed from target.');
PHPUnit_Framework_Assert::assertEquals(1, count($prop->activeLock), 'Target parent active lock gone.');
PHPUnit_Framework_Assert::assertEquals('opaquelocktoken:1234', $prop->activeLock[0]->token->__toString());
}
示例7: __construct
protected function __construct($server_url, $capabilities)
{
$this->server_url = $server_url;
$this->browser = $capabilities['browserName'];
$payload = array("desiredCapabilities" => $capabilities);
$response = $this->execute("POST", "/session", $payload);
// Parse out session id for Selenium <= 2.33.0
$matches = array();
preg_match("/Location:.*\\/(.*)/", $response['header'], $matches);
if (count($matches) === 2) {
$this->session_id = trim($matches[1]);
}
if (!$this->session_id) {
// Starting with Selenium 2.34.0, the session id is in the body instead
if (isset($response['body'])) {
$capabilities = json_decode(trim($response['body']), true);
if ($capabilities !== null && isset($capabilities['sessionId'])) {
$this->session_id = $capabilities['sessionId'];
}
}
}
if (!$this->session_id) {
// The Chrome driver returns the session id in the value array
$this->session_id = WebDriver::GetJSONValue($response, "webdriver.remote.sessionid");
}
PHPUnit_Framework_Assert::assertNotNull($this->session_id, "Did not get a session id from {$server_url}\n" . print_r($response, true));
}
示例8: assertLockDiscoveryPropertyCorrect
public function assertLockDiscoveryPropertyCorrect(ezcWebdavMemoryBackend $backend)
{
$prop = $backend->getProperty('/collection/newresource.xml', 'lockdiscovery');
PHPUnit_Framework_Assert::assertNotNull($prop, 'Lock discovery property not set.');
PHPUnit_Framework_Assert::assertType('ezcWebdavLockDiscoveryProperty', $prop, 'Lock discovery property has incorrect type.');
PHPUnit_Framework_Assert::assertEquals(1, count($prop->activeLock), 'Number of activeLock elements incorrect.');
PHPUnit_Framework_Assert::assertEquals(new ezcWebdavPotentialUriContent('http://example.com/some/user', true), $prop->activeLock[0]->owner, 'Lock owner not correct.');
}
示例9: assertDestinationCorrect
public function assertDestinationCorrect(ezcWebdavMemoryBackend $backend)
{
PHPUnit_Framework_Assert::assertTrue($backend->nodeExists('/other_collection/moved_resource.html'));
$prop = $backend->getProperty('/other_collection/moved_resource.html', 'lockdiscovery');
PHPUnit_Framework_Assert::assertNotNull($prop, 'Lock discovery property not available on destination.');
PHPUnit_Framework_Assert::assertType('ezcWebdavLockDiscoveryProperty', $prop);
PHPUnit_Framework_Assert::assertEquals(1, count($prop->activeLock), 'Active lock element not available on destination.');
PHPUnit_Framework_Assert::assertEquals('opaquelocktoken:5678', $prop->activeLock[0]->token->__toString(), 'Active lock token on destination incorrect.');
}
示例10: haveItem
/**
* Проверка наличия предмета в инвентаре
* @param string $itemId
* @return InventoryItem
*/
public function haveItem($itemId)
{
$symfonyModule = $this->getSymfonyModule();
$user = $this->getUser($symfonyModule);
$itemRepository = $symfonyModule->container->get('kingdom.inventory_item_repository');
$item = $itemRepository->findOneByUserAndItemId($user, $itemId);
\PHPUnit_Framework_Assert::assertNotNull($item);
return $item;
}
示例11: _enterEmailAddress
protected function _enterEmailAddress($email)
{
$id = 'check-email';
$input = $this->getSession()->getPage()->find('xpath', '//*[@id="' . $id . '"]');
\PHPUnit_Framework_Assert::assertNotNull($input);
$this->getSession()->getPage()->fillField($id, $email);
$this->getSession()->getDriver()->click('//button[@onclick="checkEmail(this);"]');
sleep(2);
}
示例12: assertDestinationSourceStillCorrect
public function assertDestinationSourceStillCorrect(ezcWebdavMemoryBackend $backend)
{
$prop = $backend->getProperty('/collection', 'lockdiscovery');
PHPUnit_Framework_Assert::assertNotNull($prop, 'Lock discovery property set on source parent.');
PHPUnit_Framework_Assert::assertEquals(1, count($prop->activeLock), 'Active lock available not on source parent.');
$prop = $backend->getProperty('/collection/resource.html', 'lockdiscovery');
PHPUnit_Framework_Assert::assertNotNull($prop, 'Lock discovery property set on source.');
PHPUnit_Framework_Assert::assertEquals(1, count($prop->activeLock), 'Active lock available not on source.');
}
示例13: testAPI
public function testAPI()
{
$api = new RippleAPI(new Connection());
$index = $api->currentLedgerIndex();
PHPUnit::assertNotNull($index);
PHPUnit::assertGreaterThan(6000000, $index);
$index = $api->currentLedgerIndex();
PHPUnit::assertNotNull($index);
PHPUnit::assertGreaterThan(6000000, $index);
}
示例14: testCreateAndSave
public function testCreateAndSave()
{
$directory = new FooDirectory($this->getMongoDB());
$model = $directory->create([]);
$model['added1'] = 'yes';
$model = $directory->save($model);
PHPUnit::assertNotNull($model['_id']);
$model = $directory->reload($model);
PHPUnit::assertEquals('yes', $model['added1']);
}
示例15: seeLink
/**
* Checks if the document has link that contains specified
* text (or text and url)
*
* @param string $text
* @param string $url (Default: null)
* @return mixed
*/
public function seeLink($text, $url = null)
{
$text = $this->escape($text);
$nodes = $this->session->getPage()->findAll('named', array('link', $this->session->getSelectorsHandler()->xpathLiteral($text)));
if (!$url) {
return \PHPUnit_Framework_Assert::assertNotNull($nodes);
}
foreach ($nodes as $node) {
if (false !== strpos($node->getAttribute('href'), $url)) {
return \PHPUnit_Framework_Assert::assertContains($text, $node->getHtml(), "with url '{$url}'");
}
}
return \PHPUnit_Framework_Assert::fail("with url '{$url}'");
}