eloquent-meta/tests/MetaTest.php

34 lines
798 B
PHP
Raw Normal View History

<?php
namespace Glmdev\Meta\Tests;
use Glmdev\Meta\Meta;
2016-06-25 22:10:21 +00:00
use Ramsey\Uuid\Uuid;
class MetaTest extends \PHPUnit_Framework_TestCase
{
2016-06-25 22:10:21 +00:00
public function testReadWrite ()
{
$model = Meta::create();
$model->write('name', 'John');
$model->write('age', 15);
$model->write('email', 'Johnny@appleseed.com');
$this->assertEquals('John', $model->read('name'));
$this->assertEquals(15, $model->read('age'));
$this->assertEquals('Johnny@appleseed.com', $model->read('email'));
}
2016-06-25 22:10:21 +00:00
public function testUuid ()
{
2016-06-25 22:10:21 +00:00
$model = Meta::create();
$uuid = Uuid::uuid4();
$this->assertTrue($model->hasUuid());
$model->setRawUuid($uuid);
$this->assertEquals($uuid, $model->getUuid());
}
}