-
-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #43 from atsanna/user-settings
- Fix user settings
- Loading branch information
Showing
9 changed files
with
335 additions
and
264 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,79 +1,91 @@ | ||
<?php | ||
|
||
/** | ||
* This file is part of Bonfire. | ||
* | ||
* (c) Lonnie Ezell <lonnieje@gmail.com> | ||
* | ||
* For the full copyright and license information, please view | ||
* the LICENSE file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Tests\Bonfire\Widgets; | ||
|
||
use Bonfire\Libraries\Widgets\Charts\ChartsItem; | ||
use Bonfire\Libraries\Widgets\Charts\ChartsCollection; | ||
use Bonfire\Libraries\Widgets\Charts\ChartsItem; | ||
use Tests\Support\TestCase; | ||
|
||
class ChartsCollectionTest extends TestCase | ||
/** | ||
* @internal | ||
*/ | ||
final class ChartsCollectionTest extends TestCase | ||
{ | ||
public function testExtendsChartsItem() | ||
{ | ||
$item = new ChartsCollection([ | ||
'title' => 'Item A', | ||
'type' => 'line', | ||
'cssClass' => 'col-3', | ||
]); | ||
public function testExtendsChartsItem() | ||
{ | ||
$item = new ChartsCollection([ | ||
'title' => 'Item A', | ||
'type' => 'line', | ||
'cssClass' => 'col-3', | ||
]); | ||
|
||
$this->assertEquals('Item A', $item->title()); | ||
$this->assertEquals('line', $item->type()); | ||
$this->assertEquals('col-3', $item->cssClass()); | ||
} | ||
$this->assertSame('Item A', $item->title()); | ||
$this->assertSame('line', $item->type()); | ||
$this->assertSame('col-3', $item->cssClass()); | ||
} | ||
|
||
public function testTitles() | ||
{ | ||
$collection = new ChartsCollection(); | ||
$this->assertNull($collection->title()); | ||
public function testTitles() | ||
{ | ||
$collection = new ChartsCollection(); | ||
$this->assertNull($collection->title()); | ||
|
||
$collection = new ChartsCollection(['title' => 'Foo']); | ||
$this->assertEquals('Foo', $collection->title()); | ||
$collection = new ChartsCollection(['title' => 'Foo']); | ||
$this->assertSame('Foo', $collection->title()); | ||
|
||
$collection = new ChartsCollection(); | ||
$collection->setTitle('Foo'); | ||
$this->assertEquals('Foo', $collection->title()); | ||
} | ||
$collection = new ChartsCollection(); | ||
$collection->setTitle('Foo'); | ||
$this->assertSame('Foo', $collection->title()); | ||
} | ||
|
||
public function testWithItem() | ||
{ | ||
$collection = new ChartsCollection(['name' => 'Foo']); | ||
$item1 = new ChartsItem(['title' => 'Item 1']); | ||
$item2 = new ChartsItem(['title' => 'Item 2']); | ||
public function testWithItem() | ||
{ | ||
$chart_collection = new ChartsCollection(['name' => 'Foo']); | ||
$item1 = new ChartsItem(['title' => 'Item 1']); | ||
$item2 = new ChartsItem(['title' => 'Item 2']); | ||
|
||
$collection->addItem($item1); | ||
$collection->addItem($item2); | ||
$chart_collection->addItem($item1); | ||
$chart_collection->addItem($item2); | ||
|
||
$items = $collection->items(); | ||
$items = $chart_collection->items(); | ||
|
||
$this->assertCount(2, $items); | ||
$this->assertEquals('Item 1', $items[0]->title()); | ||
$this->assertEquals('Item 2', $items[1]->title()); | ||
$this->assertCount(2, $items); | ||
$this->assertSame('Item 1', $items[0]->title()); | ||
$this->assertSame('Item 2', $items[1]->title()); | ||
|
||
$collection->removeItem('Item 1'); | ||
$chart_collection->removeItem('Item 1'); | ||
|
||
$items = $collection->items(); | ||
$items = $chart_collection->items(); | ||
|
||
$this->assertCount(1, $items); | ||
$this->assertEquals('Item 2', $items[0]->title()); | ||
$this->assertCount(1, $items); | ||
$this->assertSame('Item 2', $items[0]->title()); | ||
|
||
$collection->removeAllItems(); | ||
$chart_collection->removeAllItems(); | ||
|
||
$items = $collection->items(); | ||
$this->assertEquals([], $items); | ||
} | ||
$items = $chart_collection->items(); | ||
$this->assertSame([], $items); | ||
} | ||
|
||
public function testAddItems() | ||
{ | ||
$collection = new ChartsCollection(['name' => 'Foo']); | ||
$item1 = new ChartsItem(['title' => 'Item 1']); | ||
$item2 = new ChartsItem(['title' => 'Item 2']); | ||
public function testAddItems() | ||
{ | ||
$chart_collection = new ChartsCollection(['name' => 'Foo']); | ||
$item1 = new ChartsItem(['title' => 'Item 1']); | ||
$item2 = new ChartsItem(['title' => 'Item 2']); | ||
|
||
$collection->addItems([$item1, $item2]); | ||
$chart_collection->addItems([$item1, $item2]); | ||
|
||
$items = $collection->items(); | ||
$items = $chart_collection->items(); | ||
|
||
$this->assertCount(2, $items); | ||
$this->assertEquals('Item 1', $items[0]->title()); | ||
$this->assertEquals('Item 2', $items[1]->title()); | ||
} | ||
$this->assertCount(2, $items); | ||
$this->assertSame('Item 1', $items[0]->title()); | ||
$this->assertSame('Item 2', $items[1]->title()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,46 @@ | ||
<?php | ||
|
||
namespace Tests\Bonfire\Widgets; | ||
/** | ||
* This file is part of Bonfire. | ||
* | ||
* (c) Lonnie Ezell <lonnieje@gmail.com> | ||
* | ||
* For the full copyright and license information, please view | ||
* the LICENSE file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Tests\Bonfire\Widgets; | ||
|
||
use Bonfire\Libraries\Widgets\Charts\ChartsItem; | ||
use Tests\Support\TestCase; | ||
|
||
class ChartsItemTest extends TestCase | ||
/** | ||
* @internal | ||
*/ | ||
final class ChartsItemTest extends TestCase | ||
{ | ||
public function testBasicDetails() | ||
{ | ||
$item = new ChartsItem(); | ||
$item->setTitle('Item A') | ||
->setType('line') | ||
->setType('line') | ||
->setCssclass('col-3'); | ||
|
||
$this->assertEquals('Item A', $item->title()); | ||
$this->assertEquals('line', $item->type()); | ||
$this->assertEquals('col-3', $item->cssClass()); | ||
$this->assertSame('Item A', $item->title()); | ||
$this->assertSame('line', $item->type()); | ||
$this->assertSame('col-3', $item->cssClass()); | ||
} | ||
|
||
public function testConstructorFill() | ||
{ | ||
$item = new ChartsItem([ | ||
'title' => 'Item A', | ||
'type' => 'line', | ||
'cssClass' => 'col-3', | ||
]); | ||
'title' => 'Item A', | ||
'type' => 'line', | ||
'cssClass' => 'col-3', | ||
]); | ||
|
||
$this->assertEquals('Item A', $item->title()); | ||
$this->assertEquals('line', $item->type()); | ||
$this->assertEquals('col-3', $item->cssClass()); | ||
$this->assertSame('Item A', $item->title()); | ||
$this->assertSame('line', $item->type()); | ||
$this->assertSame('col-3', $item->cssClass()); | ||
} | ||
} |
Oops, something went wrong.