Exemplo n.º 1
0
 public function testFindNested()
 {
     $this->db->set('mytype', 'obj1', new FakeDatabaseTest_Object(array('array' => array('foo' => 'bar', 'bar' => 'baz'))));
     $this->db->set('mytype', 'obj2', new FakeDatabaseTest_OtherObject(array('array' => array('foo' => 'not matching', 'bar' => 'not matching'))));
     $match = $this->db->find('mytype', 'array.foo', 'bar');
     $this->assertInstanceOf('FakeObject', $match);
     $this->assertEquals('bar', $match->array['foo']);
 }
Exemplo n.º 2
0
 function testOldPasswordValidatesWithOldValidatorAndMigrates()
 {
     $userid = 1;
     $fakeEncryption = new FakePasswordEncryption();
     $salt = $fakeEncryption->Salt();
     $oldpassword = $this->oldEncryption->Encrypt($this->plaintext);
     $newpassword = '';
     $migration = new PasswordMigration();
     $password = $migration->Create($this->plaintext, $oldpassword, $newpassword);
     $password->Encryption = $fakeEncryption;
     $isValid = $password->Validate('');
     $this->assertTrue($isValid, 'should have validated against the old password');
     $password->Migrate($userid);
     $encrypted = $fakeEncryption->Encrypt($this->plaintext, $salt);
     $this->assertTrue($this->_db->ContainsCommand(new MigratePasswordCommand($userid, $encrypted, $salt)), "did not migrate the password");
 }