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()); } } }
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); }
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.'); }
/** * 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); }
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()); }
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()); } } }
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(); }
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); }
public function toBeNull() { if ($this->negate) { a::assertNotNull($this->actual); } else { a::assertNull($this->actual); } }
public function assertLockDiscoveryPropertyNowhereElse(ezcWebdavMemoryBackend $backend) { $prop = $backend->getProperty('/collection', 'lockdiscovery'); PHPUnit_Framework_Assert::assertNull($prop); }
public function dontSeeOptionIsSelected($select, $text) { $option = $this->findSelectedOption($select); if (!$option) { \PHPUnit_Framework_Assert::assertNull($option); return; } $this->assertNotEquals($text, $option->getText()); }
/** * 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)); } }
public function testBitcoinTransaction() { $parser = new Parser(); $tx_data = $this->getSampleBitcoinTransaction(); $type = $parser->lookupCounterpartyTransactionType($tx_data, 1); PHPUnit::assertNull($type); }
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)); }
public function null() { a::assertNull($this->actual, $this->description); }
/** * @depends testGetSetting */ public function testDeleteSetting($setting) { // Delete Test self::$pdo->delete($setting['domain'], $setting['settingKey']); $ret = self::$pdo->get($setting['domain'], $setting['settingKey']); PHPUnit_Framework_Assert::assertNull($ret); }
/** * @Given /^the node "([^"]*)" should not exist$/ */ public function theNodeShouldNotExist($arg1) { $session = $this->getSession(); $node = $session->getNode($arg1); \PHPUnit_Framework_Assert::assertNull($node); }
/** * @Given the entity :entityName with id :id does not exist */ public function theEntityWithIdDoesNotExist($entityName, $id) { $entity = $this->get('doctrine')->getRepository($entityName)->findOneById($id); Assert::assertNull($entity, "Result of 'findOneById' should be NULL when an entity does not exist"); }
public function assertTargetPropertyNotSet(ezcWebdavMemoryBackend $backend) { $prop = $backend->getProperty('/collection/resource.html', 'authors', 'http://www.w3.com/standards/z39.50/'); PHPUnit_Framework_Assert::assertNull($prop, 'Desired property not set.'); }
/** * Expect that a variable is null. * * @param string $message * * @return Expect */ public function toBeNull($message = '') { Assert::assertNull($this->value, $message); return $this; }
public function assertDestinationParentStillCorrect(ezcWebdavMemoryBackend $backend) { $prop = $backend->getProperty('/other_collection', 'lockdiscovery'); PHPUnit_Framework_Assert::assertNull($prop, 'Lock discovery property set on destination parent.'); }
/** * Then I (?:don\'t|do not) see "<header>" header */ public function iDonTSeeResponseHeader($header) { Assertion::assertNull($this->restClient->getResponseHeader($header), "Unexpected '{$header}' header found with '{$this->restClient->getResponseHeader($header)}' value"); }
/** * @Given I should not see a pager */ public function assertNotPager() { \PHPUnit_Framework_Assert::assertNull($this->getPager(), 'The pager could be found.'); }
/** * @Then the JSON node :node should be null * * @param string $node */ public function theJsonNodeShouldBeNull($node) { $json = $this->getJson(); $actual = $this->inspector->evaluate($json, $node); PHPUnit::assertNull($actual, sprintf('Expected node %s to be not null, got %s instead.', $node, json_encode($actual))); }
protected function setupFields() { \PHPUnit_Framework_Assert::assertNull($this->addField($this->field)); }
/** * @Then response header :header don't exist */ public function dontExistResponseHeader($header) { Assertion::assertNull($this->restDriver->getHeader($header), "Unexpected '{$header}' header found with '{$this->restDriver->getHeader($header)}' value"); }
/** * Checks that variable is NULL * * @param $actual * @param string $message */ protected function assertNull($actual, $message = '') { \PHPUnit_Framework_Assert::assertNull($actual, $message); }
/** * @Then the sprint :sprint should not exist */ public function theSprintShouldNotExist($sprint) { PHPUnit::assertNull(Sprint::where('title', $sprint)->first()); }
/** * Asserts that a variable is NULL. * * @param mixed $actual * @param string $message */ function assertNull($actual, $message = '') { return PHPUnit_Framework_Assert::assertNull($actual, $message); }
/** * @Then I see that a/an :name role does not exists * * Verifies that a role with $name exists. * */ public function iDontSeeRole($name) { $role = $this->getRoleManager()->getRole($name); Assertion::assertNull($role, "Found Role with name {$name}"); }