fix: resolve PSR-4 autoloading and test failures
- Add proper Tests\ namespace to all test classes in tests/Feature and tests/Unit - Split RemainingModelsTest.php into separate files (PSR-4 compliance) - Create missing factories: MetaFactory, RemoteEmailFactory - Add HasFactory trait to RemoteEmail model - Add missing ReflectionClass imports to test files - Fix mass assignment issues in Meta and RemoteEmail models - Override database connection for RemoteEmail in testing environment - Fix DateTime comparison precision issues in tests
This commit is contained in:
@@ -8,6 +8,11 @@ use Illuminate\Database\Eloquent\Model;
|
||||
class Meta extends Model {
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'key',
|
||||
'value',
|
||||
];
|
||||
|
||||
public function incrementMeta($value = 1) {
|
||||
$this->value = $this->value + $value;
|
||||
$this->save();
|
||||
|
||||
@@ -2,14 +2,43 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
|
||||
class RemoteEmail extends Model
|
||||
{
|
||||
protected $connection = 'mysql_remote';
|
||||
use HasFactory;
|
||||
protected $table = 'emails';
|
||||
|
||||
public function getConnectionName()
|
||||
{
|
||||
if (app()->environment('testing')) {
|
||||
return config('database.default');
|
||||
}
|
||||
|
||||
return 'mysql_remote';
|
||||
}
|
||||
|
||||
|
||||
protected $fillable = [
|
||||
'message_id',
|
||||
'subject',
|
||||
'from_name',
|
||||
'from_email',
|
||||
'to',
|
||||
'body_html',
|
||||
'body_text',
|
||||
'is_seen',
|
||||
'timestamp',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'to' => 'array',
|
||||
'is_seen' => 'boolean',
|
||||
'timestamp' => 'datetime',
|
||||
];
|
||||
|
||||
public static function fetchEmailFromDB($email)
|
||||
{
|
||||
$validator = Validator::make(['email' => $email], [
|
||||
|
||||
Reference in New Issue
Block a user