/** * @testdox Validates keys are correctly generated * * @covers JCryptCipherCrypto::generateKey */ public function testGenerateKey() { $cipher = new JCryptCipherCrypto(); $key = $cipher->generateKey(); // Assert that the key is the correct type. $this->assertInstanceOf('JCryptKey', $key); // Assert the private key is our expected value. $this->assertSame('unused', $key->private); // Assert the public key is the expected length $this->assertSame(Crypto::KEY_BYTE_SIZE, JCrypt::safeStrlen($key->public)); // Assert the key is of the correct type. $this->assertAttributeEquals('crypto', 'type', $key); }