/** * Test with second Encrypter and check the encoded value is not equal, because secure key must be random. */ public function testNonEqualSecondEncrypterRandom() { $encrypter = new Encrypter(); $encrypter2 = new Encrypter(); $originalValue = $this->generateRandomString(); $encodedValue1 = $encrypter->encode($originalValue); $encodedValue2 = $encrypter2->encode($originalValue); $this->assertNotSame($encodedValue1, $encodedValue2); }
/** * Test with second Encrypter and check the encoded value is equal, because secure key is fixed. */ public function testEqualSecondEncrypterFixed() { $encrypter = new Encrypter($this->secureKey); $encrypter2 = new Encrypter(); // Create random $encrypter2->setSecureKey($this->secureKey); // Then change to fixed secure key $originalValue = $this->generateRandomString(); $encodedValue1 = $encrypter->encode($originalValue); $encodedValue2 = $encrypter2->encode($originalValue); $this->assertEquals($encodedValue1, $encodedValue2); }