@@ -25,6 +25,38 @@ public function testCreate()
2525 $ this ->assertTrue ($ model ->exists );
2626 }
2727
28+ public function testCreateShouldBeEncryptedRaw ()
29+ {
30+ $ model = DatabaseModel::create ($ this ->randomValues ());
31+
32+ $ this ->assertTrue ($ model ->exists );
33+
34+ $ values = $ model ->getRawValues (['id ' , 'should_be_encrypted ' ]);
35+
36+ $ this ->assertNotNull ($ values );
37+ $ this ->assertTrue (is_array ($ values ));
38+ $ this ->assertArrayHasKey ('id ' , $ values );
39+ $ this ->assertArrayHasKey ('should_be_encrypted ' , $ values );
40+ $ this ->assertTrue (is_string ($ values ['should_be_encrypted ' ]));
41+ $ this ->assertStringStartsWith (chr (1 ) . chr (2 ) . '__LARAVEL-DATABASE-ENCRYPTED-VERSION- ' , $ values ['should_be_encrypted ' ]);
42+ }
43+
44+ public function testCreateShouldntBeEncryptedRaw ()
45+ {
46+ $ model = DatabaseModel::create ($ this ->randomValues ());
47+
48+ $ this ->assertTrue ($ model ->exists );
49+
50+ $ values = $ model ->getRawValues (['id ' , 'shouldnt_be_encrypted ' ]);
51+
52+ $ this ->assertNotNull ($ values );
53+ $ this ->assertTrue (is_array ($ values ));
54+ $ this ->assertArrayHasKey ('id ' , $ values );
55+ $ this ->assertArrayHasKey ('shouldnt_be_encrypted ' , $ values );
56+ $ this ->assertTrue (is_string ($ values ['shouldnt_be_encrypted ' ]));
57+ $ this ->assertStringStartsNotWith (chr (1 ) . chr (2 ) . '__LARAVEL-DATABASE-ENCRYPTED-VERSION- ' , $ values ['shouldnt_be_encrypted ' ]);
58+ }
59+
2860 public function testUpdate ()
2961 {
3062 $ model = DatabaseModel::create ($ this ->randomValues ());
0 commit comments