Skip to content

Instantly share code, notes, and snippets.

View amochohan's full-sized avatar

Amo Chohan amochohan

View GitHub Profile
@amochohan
amochohan / example.php
Created October 27, 2017 08:09
Generating a timeseries - Carbon vs native PHP
<?php
$timeSeries = [];
// Using Carbon
$start = \Carbon\Carbon::create(1983, 9, 1, 0, 0, 0);
$end = \Carbon\Carbon::create(2050, 1, 1, 0, 0,0);
while ($start->format('Y-m-d') < $end->format('Y-m-d')) {
$start->addDay();
<?php
class CalculatorTest extends TestCase
{
/** @test */
public function it_adds_two_numbers()
{
$calculator = new Calculator();
$total = $calculator->sum(1, 2);
$this->assertSame(3, $total);