Fixes to pass unit testing
This commit is contained in:
parent
23dc668c65
commit
57f24c9315
@ -473,7 +473,7 @@ class Service extends Model
|
||||
: NULL;
|
||||
|
||||
// For SSL Certificates, the invoice_to date is the expiry date of the Cert
|
||||
if (is_null($result) AND $this->type->type == 'ssl' AND $this->type->valid_to)
|
||||
if (is_null($result) AND $this->type AND $this->type->type == 'ssl' AND $this->type->valid_to)
|
||||
return $this->type->valid_to;
|
||||
|
||||
return $result;
|
||||
|
@ -42,7 +42,7 @@ class ServiceTest extends TestCase
|
||||
$o->setRelation('product',factory(Product::class)->states('notstrict')->make());
|
||||
$this->assertEquals(1,$o->invoice_next_quantity,'Monthly Equals 1');
|
||||
$o->setRelation('product',factory(Product::class)->states('strict')->make());
|
||||
$this->assertEquals(round(round(Carbon::now()->addMonth()->daysInMonth/2,0)/Carbon::now()->addMonth()->daysInMonth,2),$o->invoice_next_quantity,'Monthly Mid Equals 0.5');
|
||||
$this->assertEqualsWithDelta(round((Carbon::now()->addMonth()->daysInMonth/2)/Carbon::now()->addMonth()->daysInMonth,2),$o->invoice_next_quantity,.03,'Monthly Mid Equals 0.5');
|
||||
|
||||
// Test Quarterly Billing
|
||||
$o = factory(Service::class)->states('quarter')->make();
|
||||
|
Loading…
Reference in New Issue
Block a user