assertArrayNotHasKey() public static method

Asserts that an array does not have a specified key.
public static assertArrayNotHasKey ( mixed $key, array | ArrayAccess $array, string $message = '' )
$key mixed
$array array | ArrayAccess
$message string
コード例 #1
0
 /**
  * Assert that the response view is missing a piece of bound data.
  *
  * @param  string  $key
  * @return void
  */
 public function assertViewMissing($key)
 {
     if (!isset($this->response->original) || !$this->response->original instanceof View) {
         return PHPUnit::assertTrue(false, 'The response was not a view.');
     }
     PHPUnit::assertArrayNotHasKey($key, $this->response->original->getData());
 }
コード例 #2
0
 public function testIncomingInvalidatedTransactionUpdatesLedgerEntries()
 {
     $provisional_tx_repository = app('App\\Repositories\\ProvisionalTransactionRepository');
     $notification_repository = app('App\\Repositories\\NotificationRepository');
     $ledger_entry_repository = app('App\\Repositories\\LedgerEntryRepository');
     // setup monitors
     $payment_address_helper = app('PaymentAddressHelper');
     $payment_address_one = $payment_address_helper->createSamplePaymentAddressWithoutInitialBalances(null, ['address' => '1JztLWos5K7LsqW5E78EASgiVBaCe6f7cD']);
     // receive unconfirmed transactions
     $parsed_txs = $this->receiveUnconfirmedTransactions(1);
     // check accounts
     $account_one = AccountHandler::getAccount($payment_address_one, 'default');
     $balance = $ledger_entry_repository->accountBalancesByAsset($account_one, null);
     PHPUnit::assertEquals(0.004, $balance['unconfirmed']['BTC']);
     // now confirm a malleated version of the transaction
     $malleated_tx = $parsed_txs[0];
     $malleated_tx['txid'] = str_repeat('0', 54) . 'MALLEATED1';
     $malleated_txs = [$malleated_tx];
     // now confirm the malleated transaction (with 2 confirmations)
     $this->sendConfirmationEvents(2, $malleated_txs);
     // check for invalidation notification
     $balance = $ledger_entry_repository->accountBalancesByAsset($account_one, null);
     PHPUnit::assertEquals(0.004, $balance['confirmed']['BTC']);
     PHPUnit::assertArrayNotHasKey('BTC', $balance['unconfirmed']);
 }
コード例 #3
0
ファイル: EnumTest.php プロジェクト: videodock/enum
 /**
  * @test
  */
 public function it_detects_proper_values_and_constants()
 {
     $enum = new FakeEnum();
     \PHPUnit_Framework_Assert::assertContains('SOME_KEY', $enum->keys());
     \PHPUnit_Framework_Assert::assertArrayHasKey('SOME_KEY', $enum->values());
     \PHPUnit_Framework_Assert::assertArrayNotHasKey('some-value', $enum->values());
     \PHPUnit_Framework_Assert::assertContains('some-value', $enum->values());
     \PHPUnit_Framework_Assert::assertSame('SOME_KEY', $enum->getConstantForValue('some-value'));
     \PHPUnit_Framework_Assert::assertTrue($enum->has('some-value'));
     \PHPUnit_Framework_Assert::assertFalse($enum->has('SOME-VALUE'));
 }
コード例 #4
0
ファイル: Functions.php プロジェクト: delkyd/sugarcrm_dev
/**
 * Asserts that an array does not have a specified key.
 *
 * @param  mixed  $key
 * @param  array  $array
 * @param  string $message
 * @since  Method available since Release 3.0.0
 */
function assertArrayNotHasKey($key, array $array, $message = '')
{
    return PHPUnit_Framework_Assert::assertArrayNotHasKey($key, $array, $message);
}
コード例 #5
0
ファイル: Expect.php プロジェクト: jasonmccreary/expect
 public function toHaveKey($key)
 {
     if ($this->negate) {
         a::assertArrayNotHasKey($key, $this->actual);
     } else {
         a::assertArrayHasKey($key, $this->actual);
     }
 }
コード例 #6
0
ファイル: RedisDriverSpec.php プロジェクト: mgdigital/busque
 public function it_can_receive_due_scheduled_commands()
 {
     $date = new \DateTimeImmutable();
     $timestamp = $date->getTimestamp();
     $lua = $this->getLua('receive_due_messages');
     $this->adapter->evalLua($lua, ['test', 0, $timestamp, SchedulerWorker::DEFAULT_THROTTLE])->shouldBeCalled()->willReturn([['test', 'test', 'test', $timestamp]]);
     $commandsWrapper = $this->receiveDueCommands($date);
     $commands = $commandsWrapper->getWrappedObject();
     \PHPUnit_Framework_Assert::assertArrayHasKey(0, $commands);
     \PHPUnit_Framework_Assert::assertArrayNotHasKey(1, $commands);
     \PHPUnit_Framework_Assert::assertEquals('test', $commands[0]->getId());
 }
コード例 #7
0
ファイル: Verify.php プロジェクト: jaschweder/Verify
 public function hasntKey($key)
 {
     a::assertArrayNotHasKey($key, $this->actual, $this->description);
 }
コード例 #8
0
ファイル: Expect.php プロジェクト: jpkleemans/phpunit-expect
 /**
  * Expect that an array does not have a specified key.
  *
  * @param mixed $key
  * @param string $message
  *
  * @return Expect
  */
 public function notToHaveKey($key, $message = '')
 {
     Assert::assertArrayNotHasKey($key, $this->value, $message);
     return $this;
 }
コード例 #9
0
 public function arrayToNotHaveKey($key)
 {
     \PHPUnit_Framework_Assert::assertArrayNotHasKey($key, $this->actual);
 }
コード例 #10
0
 /**
  * @Then /^in the response there is no field called "([^"]*)"$/
  * @param string $name
  * @return void
  * @throws \Exception
  */
 public function theResponseShouldNotHaveAField($name)
 {
     Assertions::assertArrayNotHasKey($name, $this->getResponseData());
 }
コード例 #11
0
 /**
  * @Then /^there should not be "([^"]*)" parameter$/
  */
 public function thereShouldNotBeParameter($key)
 {
     \PHPUnit_Framework_Assert::assertArrayNotHasKey($key, $this->containerParameters);
 }
コード例 #12
0
 /**
  * @param $key
  * @param $actual
  * @param $description
  */
 protected function assertArrayNotHasKey($key, $actual, $description)
 {
     \PHPUnit_Framework_Assert::assertArrayNotHasKey($key, $actual, $description);
 }