定制 ohseesoftware/laravel-assert-encrypted 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

ohseesoftware/laravel-assert-encrypted

最新稳定版本:v1.2.1

Composer 安装命令:

composer require ohseesoftware/laravel-assert-encrypted

包简介

Add an assertion to test for encrypted values in your database.

README 文档

README

Current Release Build Status Badge Coverage Status Maintainability Score Downloads MIT License

Add an assertion to test for encrypted values in your database.

Install

composer require ohseesoftware/laravel-assert-encrypted 

Usage

Say you have an encrypted value in your database:

User::create([ 'name' => 'John Doe', 'secret' => encrypt('api-key') ]);

It's a bit hard to test the value of secret in the database because there's randomness in encrypt(). This means encrypt('value') !== encrypt('value').

To get around this, you can use the trait exposed in this package in your tests:

<?php namespace Tests; use OhSeeSoftware\LaravelAssertEncrypted\Traits\AssertEncrypted; class SomeTest extends TestCase { use AssertEncrypted; /** @test */ public function it_stores_users_secrets() { // Given $user = factory(User::class)->create([ 'secret' => encrypt('api-key') ]); // Then $this->assertEncrypted('users', ['id' => $user->id], [ 'secret' => 'api-key' ]); // assertEncrypted is an alias for assertEncryptedSerialized // since encrypt by default serializes the passed value } }

If your values are not serialized before encryption, you can use the assertEncryptedUnserialized assertion.

<?php /** @test */ public function it_stores_users_secrets() { // Given $user = factory(User::class)->create([ 'secret' => encrypt('api-key', false) ]); // Then $this->assertEncryptedUnserialized('users', ['id' => $user->id], [ 'secret' => 'api-key' ]); }

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email security@ohseesoftware.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

Laravel Package Boilerplate

This package was generated using the Laravel Package Boilerplate.

统计信息

  • 总下载量: 41.26k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 4
  • 点击次数: 0
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 4
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固