mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-07-31 20:20:15 +02:00
PHP7 More
This commit is contained in:
21
More/Repository/Tests/RepositoryTest.php
Normal file
21
More/Repository/Tests/RepositoryTest.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace DesignPatterns\More\Repository\Tests;
|
||||
|
||||
use DesignPatterns\More\Repository\MemoryStorage;
|
||||
use DesignPatterns\More\Repository\Post;
|
||||
use DesignPatterns\More\Repository\PostRepository;
|
||||
|
||||
class Repository extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testCanPersistAndFindPost()
|
||||
{
|
||||
$repository = new PostRepository(new MemoryStorage());
|
||||
$post = new Post(null, 'Repository Pattern', 'Design Patterns PHP');
|
||||
|
||||
$repository->save($post);
|
||||
|
||||
$this->assertEquals(1, $post->getId());
|
||||
$this->assertEquals($post->getId(), $repository->findById(1)->getId());
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user