First commit for filter by category
This commit is contained in:
committed by
Paula Quispe
parent
7b96da5bc5
commit
a874ab2390
14
database/factories/ProcessCategoryFactory.php
Normal file
14
database/factories/ProcessCategoryFactory.php
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Model factory for a process category
|
||||||
|
*/
|
||||||
|
use Faker\Generator as Faker;
|
||||||
|
|
||||||
|
$factory->define(\ProcessMaker\Model\ProcessCategory::class, function (Faker $faker) {
|
||||||
|
return [
|
||||||
|
'CATEGORY_UID' => G::generateUniqueID(),
|
||||||
|
'CATEGORY_PARENT' => '',
|
||||||
|
'CATEGORY_NAME' => $faker->paragraph(3),
|
||||||
|
'CATEGORY_ICON' => '',
|
||||||
|
];
|
||||||
|
});
|
||||||
@@ -273,4 +273,28 @@ class DelegationTest extends TestCase
|
|||||||
$this->assertCount(2, $results['data']);
|
$this->assertCount(2, $results['data']);
|
||||||
$this->assertEquals('Paul Griffis', $results['data'][0]['APP_CURRENT_USER']);
|
$this->assertEquals('Paul Griffis', $results['data'][0]['APP_CURRENT_USER']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This checks to make sure filter by category is working properly
|
||||||
|
* @test
|
||||||
|
*/
|
||||||
|
public function it_should_return_categories_of_data()
|
||||||
|
{
|
||||||
|
/*factory(User::class,100)->create();
|
||||||
|
$process = factory(Process::class, 1)->create([
|
||||||
|
'PRO_ID' => 1
|
||||||
|
]);
|
||||||
|
factory(Delegation::class, 51)->create([
|
||||||
|
'PRO_ID' => $process[0]->id
|
||||||
|
]);
|
||||||
|
// Get first page, which is 25
|
||||||
|
$results = Delegation::search(null, 0, 25, null, $process[0]->id);
|
||||||
|
$this->assertCount(25, $results['data']);
|
||||||
|
// Get second page, which is 25 results
|
||||||
|
$results = Delegation::search(null, 25, 25,null, $process[0]->id);
|
||||||
|
$this->assertCount(25, $results['data']);
|
||||||
|
// Get third page, which is only 1 result
|
||||||
|
$results = Delegation::search(null, 50, 25,null, $process[0]->id);
|
||||||
|
$this->assertCount(1, $results['data']);*/
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -24,18 +24,21 @@ class Process extends Model
|
|||||||
public function applications()
|
public function applications()
|
||||||
{
|
{
|
||||||
return $this->hasMany(Application::class, 'PRO_ID', 'PRO_ID');
|
return $this->hasMany(Application::class, 'PRO_ID', 'PRO_ID');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function tasks()
|
public function tasks()
|
||||||
{
|
{
|
||||||
return $this->hasMany(Task::class, 'PRO_UID', 'PRO_UID');
|
return $this->hasMany(Task::class, 'PRO_UID', 'PRO_UID');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function creator()
|
public function creator()
|
||||||
{
|
{
|
||||||
return $this->hasOne(User::class, 'PRO_CREATE_USER', 'USR_UID');
|
return $this->hasOne(User::class, 'PRO_CREATE_USER', 'USR_UID');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function category()
|
||||||
|
{
|
||||||
|
return $this->hasOne(ProcessCategory::class, 'PRO_CATEGORY', 'CATEGORY_UID');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
17
workflow/engine/src/ProcessMaker/Model/ProcessCategory.php
Normal file
17
workflow/engine/src/ProcessMaker/Model/ProcessCategory.php
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace ProcessMaker\Model;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class ProcessCategory
|
||||||
|
* @package ProcessMaker\Model
|
||||||
|
*
|
||||||
|
* Represents a process category object in the system.
|
||||||
|
*/
|
||||||
|
class ProcessCategory extends Model
|
||||||
|
{
|
||||||
|
// Set our table name
|
||||||
|
protected $table = 'PROCESS_CATEGORY';
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user