2014-10-25 12:27:04 +02:00
|
|
|
<?php
|
|
|
|
namespace Szurubooru\Tests\Dao;
|
2014-10-25 23:04:43 +02:00
|
|
|
use Szurubooru\Dao\PostDao;
|
2014-10-25 12:27:04 +02:00
|
|
|
use Szurubooru\Dao\PostNoteDao;
|
|
|
|
use Szurubooru\Entities\PostNote;
|
2015-11-25 11:39:32 +01:00
|
|
|
use Szurubooru\Injector;
|
2014-10-25 12:27:04 +02:00
|
|
|
use Szurubooru\Tests\AbstractDatabaseTestCase;
|
|
|
|
|
|
|
|
final class PostNoteDaoTest extends AbstractDatabaseTestCase
|
|
|
|
{
|
2015-11-25 09:48:03 +01:00
|
|
|
public function testSettingValues()
|
|
|
|
{
|
2015-11-25 11:39:32 +01:00
|
|
|
$postDao = Injector::get(PostDao::class);
|
|
|
|
$postNoteDao = Injector::get(PostNoteDao::class);
|
|
|
|
|
|
|
|
$post = self::getTestPost();
|
|
|
|
$postDao->save($post);
|
|
|
|
|
2015-11-25 09:48:03 +01:00
|
|
|
$expected = new PostNote();
|
2015-11-25 11:39:32 +01:00
|
|
|
$expected->setPost($post);
|
2015-11-25 09:48:03 +01:00
|
|
|
$expected->setLeft(5);
|
|
|
|
$expected->setTop(10);
|
|
|
|
$expected->setWidth(50);
|
|
|
|
$expected->setHeight(50);
|
|
|
|
$expected->setText('text');
|
2014-10-25 12:27:04 +02:00
|
|
|
|
2015-11-25 09:48:03 +01:00
|
|
|
$postNoteDao->save($expected);
|
2014-10-25 12:27:04 +02:00
|
|
|
|
2015-11-25 09:48:03 +01:00
|
|
|
$actual = $postNoteDao->findById($expected->getId());
|
|
|
|
$this->assertEntitiesEqual($actual, $expected);
|
2015-11-25 11:39:32 +01:00
|
|
|
$this->assertNotNull($actual->getPostId());
|
|
|
|
$this->assertEntitiesEqual($post, $actual->getPost());
|
2015-11-25 09:48:03 +01:00
|
|
|
}
|
2014-10-25 12:27:04 +02:00
|
|
|
}
|