Skip to content

Commit

Permalink
tests: Add more cases to test filter combinations
Browse files Browse the repository at this point in the history
  • Loading branch information
nilmerg committed Feb 28, 2024
1 parent 8ca38bb commit aac5e2a
Show file tree
Hide file tree
Showing 4 changed files with 1,394 additions and 0 deletions.
32 changes: 32 additions & 0 deletions tests/Lib/Model/Department.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

namespace ipl\Tests\Orm\Lib\Model;

use ipl\Orm\Model;
use ipl\Orm\Relations;

class Department extends Model
{
public function getTableName()
{
return 'department';
}

public function getKeyName()
{
return 'id';
}

public function getColumns()
{
return [
'name'
];
}

public function createRelations(Relations $relations)
{
$relations->hasMany('employee', Employee::class)
->setJoinType('LEFT');
}
}
36 changes: 36 additions & 0 deletions tests/Lib/Model/Employee.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

namespace ipl\Tests\Orm\Lib\Model;

use ipl\Orm\Model;
use ipl\Orm\Relations;

class Employee extends Model
{
public function getTableName()
{
return 'employee';
}

public function getKeyName()
{
return 'id';
}

public function getColumns()
{
return [
'name',
'role',
'department_id',
'office_id'
];
}

public function createRelations(Relations $relations)
{
$relations->belongsTo('department', Department::class);
$relations->belongsTo('office', Office::class)
->setJoinType('LEFT');
}
}
31 changes: 31 additions & 0 deletions tests/Lib/Model/Office.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

namespace ipl\Tests\Orm\Lib\Model;

use ipl\Orm\Model;
use ipl\Orm\Relations;

class Office extends Model
{
public function getTableName()
{
return 'office';
}

public function getKeyName()
{
return 'id';
}

public function getColumns()
{
return [
'city'
];
}

public function createRelations(Relations $relations)
{
$relations->hasMany('employee', Employee::class);
}
}
Loading

0 comments on commit aac5e2a

Please sign in to comment.