Skip to content

Commit

Permalink
Collection tests
Browse files Browse the repository at this point in the history
  • Loading branch information
inxilpro committed Jul 27, 2019
1 parent a4a81b5 commit b6f07f6
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions tests/Unit/AttributeCollectionTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

namespace Galahad\Aire\Tests\Unit;

use Galahad\Aire\Elements\Attributes\ClassNames;
use Galahad\Aire\Elements\Attributes\Collection;
use Galahad\Aire\Elements\Input;
use Galahad\Aire\Tests\TestCase;

class AttributeCollectionTest extends TestCase
{
public function test_it_defers_to_primary_attributes_by_default() : void
{
$collection = new Collection($this->aire(), new Input($this->aire()));

$collection->primary()->set('foo', 'bar');

$this->assertEquals('bar', $collection->get('foo'));
}

public function test_it_instantiates_attributes_lazily() : void
{
$collection = new Collection($this->aire(), new Input($this->aire()));

$collection->foo->set('bar', 'baz');

$this->assertEquals('baz', $collection->foo->get('bar'));
$this->assertInstanceOf(ClassNames::class, $collection->foo->get('class'));
}
}

0 comments on commit b6f07f6

Please sign in to comment.