-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from kirame09/hotfix/single-quote
Hotfix/single quote
- Loading branch information
Showing
3 changed files
with
41 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
C:37:"PHPUnit\Runner\DefaultTestResultCache":4239:{a:2:{s:7:"defects";a:15:{s:85:"ESolution\DBEncryption\Tests\EncryptedTest::it_test_if_encryption_decoding_is_working";i:4;s:85:"ESolution\DBEncryption\Tests\EncryptedTest::it_test_if_encryption_encoding_is_working";i:4;s:104:"ESolution\DBEncryption\Tests\EncryptedTest::it_test_that_encrypt_model_commands_encrypt_existing_records";i:4;s:90:"ESolution\DBEncryption\Tests\EncryptedTest::it_test_that_where_in_query_builder_is_working";i:4;s:110:"ESolution\DBEncryption\Tests\EncryptedTest::it_assert_that_where_does_not_retrieve_a_user_with_incorrect_email";i:4;s:109:"ESolution\DBEncryption\Tests\EncryptedTest::it_test_that_validation_rule_exists_when_record_exists_is_working";i:4;s:118:"ESolution\DBEncryption\Tests\EncryptedTest::it_test_that_validation_rule_exists_when_record_does_not_exists_is_working";i:4;s:109:"ESolution\DBEncryption\Tests\EncryptedTest::it_test_that_validation_rule_unique_when_record_exists_is_working";i:4;s:118:"ESolution\DBEncryption\Tests\EncryptedTest::it_test_that_validation_rule_unique_when_record_does_not_exists_is_working";i:4;s:88:"ESolution\DBEncryption\Tests\EncryptedTest::it_tests_that_empty_values_are_not_encrypted";i:3;s:83:"ESolution\DBEncryption\Tests\EncryptedTest::it_test_that_decrypt_command_is_working";i:4;s:96:"ESolution\DBEncryption\Tests\EncryptedTest::it_test_that_encrypted_value_is_stored_in_lower_case";i:3;s:105:"ESolution\DBEncryption\Tests\EncryptedTest::it_test_that_where_query_is_working_with_non_lowercase_values";i:4;s:88:"ESolution\DBEncryption\Tests\EncryptedTest::it_test_that_convert_to_camelcase_is_working";i:4;s:84:"ESolution\DBEncryption\Tests\EncryptedTest::it_tests_that_empty_values_are_encrypted";i:4;}s:5:"times";a:15:{s:85:"ESolution\DBEncryption\Tests\EncryptedTest::it_test_if_encryption_decoding_is_working";d:0.1710000000000000131006316905768471769988536834716796875;s:85:"ESolution\DBEncryption\Tests\EncryptedTest::it_test_if_encryption_encoding_is_working";d:0.0189999999999999995281552145343084703199565410614013671875;s:104:"ESolution\DBEncryption\Tests\EncryptedTest::it_test_that_encrypt_model_commands_encrypt_existing_records";d:0.024000000000000000499600361081320443190634250640869140625;s:90:"ESolution\DBEncryption\Tests\EncryptedTest::it_test_that_where_in_query_builder_is_working";d:0.01600000000000000033306690738754696212708950042724609375;s:110:"ESolution\DBEncryption\Tests\EncryptedTest::it_assert_that_where_does_not_retrieve_a_user_with_incorrect_email";d:0.0210000000000000013045120539345589349977672100067138671875;s:109:"ESolution\DBEncryption\Tests\EncryptedTest::it_test_that_validation_rule_exists_when_record_exists_is_working";d:0.022999999999999999611421941381195210851728916168212890625;s:118:"ESolution\DBEncryption\Tests\EncryptedTest::it_test_that_validation_rule_exists_when_record_does_not_exists_is_working";d:0.0179999999999999986399767948341832379810512065887451171875;s:109:"ESolution\DBEncryption\Tests\EncryptedTest::it_test_that_validation_rule_unique_when_record_exists_is_working";d:0.0200000000000000004163336342344337026588618755340576171875;s:118:"ESolution\DBEncryption\Tests\EncryptedTest::it_test_that_validation_rule_unique_when_record_does_not_exists_is_working";d:0.01600000000000000033306690738754696212708950042724609375;s:88:"ESolution\DBEncryption\Tests\EncryptedTest::it_tests_that_empty_values_are_not_encrypted";d:0.021999999999999998723243521681069978512823581695556640625;s:83:"ESolution\DBEncryption\Tests\EncryptedTest::it_test_that_decrypt_command_is_working";d:0.0259999999999999988065102485279567190445959568023681640625;s:96:"ESolution\DBEncryption\Tests\EncryptedTest::it_test_that_encrypted_value_is_stored_in_lower_case";d:0.01299999999999999940325512426397835952229797840118408203125;s:105:"ESolution\DBEncryption\Tests\EncryptedTest::it_test_that_where_query_is_working_with_non_lowercase_values";d:0.0189999999999999995281552145343084703199565410614013671875;s:88:"ESolution\DBEncryption\Tests\EncryptedTest::it_test_that_convert_to_camelcase_is_working";d:0.022999999999999999611421941381195210851728916168212890625;s:84:"ESolution\DBEncryption\Tests\EncryptedTest::it_tests_that_empty_values_are_encrypted";d:0.0200000000000000004163336342344337026588618755340576171875;}}} | ||
C:37:"PHPUnit\Runner\DefaultTestResultCache":3640:{a:2:{s:7:"defects";a:16:{s:85:"ESolution\DBEncryption\Tests\EncryptedTest::it_test_if_encryption_decoding_is_working";i:4;s:85:"ESolution\DBEncryption\Tests\EncryptedTest::it_test_if_encryption_encoding_is_working";i:4;s:104:"ESolution\DBEncryption\Tests\EncryptedTest::it_test_that_encrypt_model_commands_encrypt_existing_records";i:4;s:90:"ESolution\DBEncryption\Tests\EncryptedTest::it_test_that_where_in_query_builder_is_working";i:4;s:110:"ESolution\DBEncryption\Tests\EncryptedTest::it_assert_that_where_does_not_retrieve_a_user_with_incorrect_email";i:4;s:109:"ESolution\DBEncryption\Tests\EncryptedTest::it_test_that_validation_rule_exists_when_record_exists_is_working";i:4;s:118:"ESolution\DBEncryption\Tests\EncryptedTest::it_test_that_validation_rule_exists_when_record_does_not_exists_is_working";i:4;s:109:"ESolution\DBEncryption\Tests\EncryptedTest::it_test_that_validation_rule_unique_when_record_exists_is_working";i:4;s:118:"ESolution\DBEncryption\Tests\EncryptedTest::it_test_that_validation_rule_unique_when_record_does_not_exists_is_working";i:4;s:88:"ESolution\DBEncryption\Tests\EncryptedTest::it_tests_that_empty_values_are_not_encrypted";i:3;s:83:"ESolution\DBEncryption\Tests\EncryptedTest::it_test_that_decrypt_command_is_working";i:4;s:96:"ESolution\DBEncryption\Tests\EncryptedTest::it_test_that_encrypted_value_is_stored_in_lower_case";i:3;s:105:"ESolution\DBEncryption\Tests\EncryptedTest::it_test_that_where_query_is_working_with_non_lowercase_values";i:4;s:88:"ESolution\DBEncryption\Tests\EncryptedTest::it_test_that_convert_to_camelcase_is_working";i:4;s:84:"ESolution\DBEncryption\Tests\EncryptedTest::it_tests_that_empty_values_are_encrypted";i:4;s:95:"ESolution\DBEncryption\Tests\EncryptedTest::it_test_that_whereencrypted_can_handle_single_quote";i:4;}s:5:"times";a:16:{s:85:"ESolution\DBEncryption\Tests\EncryptedTest::it_test_if_encryption_decoding_is_working";d:0.285;s:85:"ESolution\DBEncryption\Tests\EncryptedTest::it_test_if_encryption_encoding_is_working";d:0.118;s:104:"ESolution\DBEncryption\Tests\EncryptedTest::it_test_that_encrypt_model_commands_encrypt_existing_records";d:0.197;s:90:"ESolution\DBEncryption\Tests\EncryptedTest::it_test_that_where_in_query_builder_is_working";d:0.131;s:110:"ESolution\DBEncryption\Tests\EncryptedTest::it_assert_that_where_does_not_retrieve_a_user_with_incorrect_email";d:0.129;s:109:"ESolution\DBEncryption\Tests\EncryptedTest::it_test_that_validation_rule_exists_when_record_exists_is_working";d:0.137;s:118:"ESolution\DBEncryption\Tests\EncryptedTest::it_test_that_validation_rule_exists_when_record_does_not_exists_is_working";d:0.11;s:109:"ESolution\DBEncryption\Tests\EncryptedTest::it_test_that_validation_rule_unique_when_record_exists_is_working";d:0.131;s:118:"ESolution\DBEncryption\Tests\EncryptedTest::it_test_that_validation_rule_unique_when_record_does_not_exists_is_working";d:0.128;s:88:"ESolution\DBEncryption\Tests\EncryptedTest::it_tests_that_empty_values_are_not_encrypted";d:0.022;s:83:"ESolution\DBEncryption\Tests\EncryptedTest::it_test_that_decrypt_command_is_working";d:0.259;s:96:"ESolution\DBEncryption\Tests\EncryptedTest::it_test_that_encrypted_value_is_stored_in_lower_case";d:0.013;s:105:"ESolution\DBEncryption\Tests\EncryptedTest::it_test_that_where_query_is_working_with_non_lowercase_values";d:0.135;s:88:"ESolution\DBEncryption\Tests\EncryptedTest::it_test_that_convert_to_camelcase_is_working";d:0.023;s:84:"ESolution\DBEncryption\Tests\EncryptedTest::it_tests_that_empty_values_are_encrypted";d:0.13;s:95:"ESolution\DBEncryption\Tests\EncryptedTest::it_test_that_whereencrypted_can_handle_single_quote";d:0.126;}}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,18 @@ | ||
<?php | ||
|
||
namespace ESolution\DBEncryption\Tests; | ||
|
||
use Illuminate\Support\Facades\DB; | ||
use Illuminate\Foundation\Testing\RefreshDatabase; | ||
|
||
class EncryptedTest extends TestCase { | ||
class EncryptedTest extends TestCase | ||
{ | ||
|
||
use RefreshDatabase; | ||
|
||
/** | ||
* @test | ||
*/ | ||
* @test | ||
*/ | ||
public function it_test_if_encryption_decoding_is_working() | ||
{ | ||
$name = 'Jhon'; | ||
|
@@ -19,7 +22,6 @@ public function it_test_if_encryption_decoding_is_working() | |
|
||
$this->assertEquals($user->email, $email); | ||
$this->assertEquals($user->name, $name); | ||
|
||
} | ||
|
||
/** | ||
|
@@ -39,8 +41,8 @@ public function it_test_if_encryption_encoding_is_working() | |
|
||
|
||
/** | ||
* @test | ||
*/ | ||
* @test | ||
*/ | ||
public function it_test_that_encrypt_model_commands_encrypt_existing_records() | ||
{ | ||
TestUser::$enableEncryption = false; | ||
|
@@ -58,8 +60,8 @@ public function it_test_that_encrypt_model_commands_encrypt_existing_records() | |
|
||
|
||
/** | ||
* @test | ||
*/ | ||
* @test | ||
*/ | ||
public function it_test_that_where_in_query_builder_is_working() | ||
{ | ||
$email = '[email protected]'; | ||
|
@@ -68,12 +70,11 @@ public function it_test_that_where_in_query_builder_is_working() | |
$user = TestUser::whereEncrypted('email', '=', $email)->first(); | ||
|
||
$this->assertNotNull($user); | ||
|
||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
* @test | ||
*/ | ||
public function it_assert_that_where_does_not_retrieve_a_user_with_incorrect_email() | ||
{ | ||
$this->createUser(); | ||
|
@@ -93,7 +94,7 @@ public function it_test_that_validation_rule_exists_when_record_exists_is_workin | |
|
||
$this->createUser('Jhon Doe', $email); | ||
|
||
$validator = validator(compact('email'), ['email'=>'exists_encrypted:test_users,email']); | ||
$validator = validator(compact('email'), ['email' => 'exists_encrypted:test_users,email']); | ||
|
||
$this->assertFalse($validator->fails()); | ||
} | ||
|
@@ -106,8 +107,8 @@ public function it_test_that_validation_rule_exists_when_record_does_not_exists_ | |
$this->createUser(); | ||
|
||
$validator = validator( | ||
['email'=>'[email protected]'], | ||
['email'=>'exists_encrypted:test_users,email'] | ||
['email' => '[email protected]'], | ||
['email' => 'exists_encrypted:test_users,email'] | ||
); | ||
|
||
$this->assertTrue($validator->fails()); | ||
|
@@ -123,7 +124,7 @@ public function it_test_that_validation_rule_unique_when_record_exists_is_workin | |
|
||
$this->createUser('Jhon Doe', $email); | ||
|
||
$validator = validator(compact('email'), ['email'=>'unique_encrypted:test_users,email']); | ||
$validator = validator(compact('email'), ['email' => 'unique_encrypted:test_users,email']); | ||
|
||
$this->assertTrue($validator->fails()); | ||
} | ||
|
@@ -136,29 +137,29 @@ public function it_test_that_validation_rule_unique_when_record_does_not_exists_ | |
$this->createUser(); | ||
|
||
$validator = validator( | ||
['email'=>'[email protected]'], | ||
['email'=>'unique_encrypted:test_users,email'] | ||
['email' => '[email protected]'], | ||
['email' => 'unique_encrypted:test_users,email'] | ||
); | ||
|
||
$this->assertFalse( $validator->fails() ); | ||
$this->assertFalse($validator->fails()); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function it_tests_that_empty_values_are_encrypted() | ||
{ | ||
$user = $this->createUser(null,'[email protected]'); | ||
$user = $this->createUser(null, '[email protected]'); | ||
$raw = DB::table('test_users')->select('*')->first(); | ||
|
||
$this->assertNotEmpty($raw->name); | ||
$this->assertEmpty($user->name); | ||
} | ||
|
||
|
||
/** | ||
* @test | ||
*/ | ||
* @test | ||
*/ | ||
public function it_test_that_decrypt_command_is_working() | ||
{ | ||
TestUser::$enableEncryption = false; | ||
|
@@ -185,4 +186,16 @@ public function it_test_that_where_query_is_working_with_non_lowercase_values() | |
$this->assertNotNull(TestUser::whereEncrypted('email', '=', '[email protected]')->first()); | ||
} | ||
|
||
} | ||
/** | ||
* @test | ||
*/ | ||
public function it_test_that_whereencrypted_can_handle_single_quote() | ||
{ | ||
$email = "[email protected]'"; | ||
$name = "Single's"; | ||
$this->createUser($name, $email); | ||
$query = TestUser::whereEncrypted('email', $email)->orWhereEncrypted('name', $name)->first(); | ||
|
||
$this->assertNotNull($query); | ||
} | ||
} |