|
|
@@ -17,28 +17,25 @@ public function test_unit_request_validates_active_students_ranges(): void
|
|
|
|
|
|
$validValidator = Validator::make([
|
|
|
'active_students_min' => 10,
|
|
|
- 'active_students_medium' => 40,
|
|
|
'active_students_max' => 90,
|
|
|
], $rules);
|
|
|
-
|
|
|
+
|
|
|
$this->assertFalse($validValidator->errors()->has('active_students_min'));
|
|
|
- $this->assertFalse($validValidator->errors()->has('active_students_medium'));
|
|
|
$this->assertFalse($validValidator->errors()->has('active_students_max'));
|
|
|
|
|
|
$invalidValidator = Validator::make([
|
|
|
'active_students_min' => -5, // Below 0
|
|
|
- 'active_students_medium' => 'string', // Not an integer
|
|
|
+ 'active_students_max' => 'string', // Not an integer
|
|
|
], $rules);
|
|
|
-
|
|
|
+
|
|
|
$this->assertTrue($invalidValidator->errors()->has('active_students_min'));
|
|
|
- $this->assertTrue($invalidValidator->errors()->has('active_students_medium'));
|
|
|
+ $this->assertTrue($invalidValidator->errors()->has('active_students_max'));
|
|
|
}
|
|
|
|
|
|
public function test_unit_resource_includes_active_students_ranges(): void
|
|
|
{
|
|
|
$unit = current(array_filter([new class extends Unit {
|
|
|
public $active_students_min = 25;
|
|
|
- public $active_students_medium = 55;
|
|
|
public $active_students_max = 85;
|
|
|
public $name = 'Teste';
|
|
|
public $social_reason = 'Teste';
|
|
|
@@ -48,11 +45,9 @@ public function test_unit_resource_includes_active_students_ranges(): void
|
|
|
$array = $resource->toArray(Request::create('/'));
|
|
|
|
|
|
$this->assertArrayHasKey('active_students_min', $array);
|
|
|
- $this->assertArrayHasKey('active_students_medium', $array);
|
|
|
$this->assertArrayHasKey('active_students_max', $array);
|
|
|
|
|
|
$this->assertSame(25, $array['active_students_min']);
|
|
|
- $this->assertSame(55, $array['active_students_medium']);
|
|
|
$this->assertSame(85, $array['active_students_max']);
|
|
|
}
|
|
|
}
|