AbstractModelTest.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. namespace Transmission\Tests\Model;
  3. class AbstractModelTest extends \PHPUnit_Framework_TestCase
  4. {
  5. protected $model;
  6. /**
  7. * @test
  8. */
  9. public function shouldImplementModelInterface()
  10. {
  11. $this->assertInstanceOf('Transmission\Model\ModelInterface', $this->getModel());
  12. }
  13. /**
  14. * @test
  15. */
  16. public function shouldHaveEmptyMappingByDefault()
  17. {
  18. $this->assertEmpty($this->getModel()->getMapping());
  19. }
  20. /**
  21. * @test
  22. */
  23. public function shouldHaveNoClientByDefault()
  24. {
  25. $this->assertNull($this->getModel()->getClient());
  26. }
  27. /**
  28. * @test
  29. */
  30. public function shouldHaveClientIfSetByUser()
  31. {
  32. $client = $this->getMock('Transmission\Client');
  33. $this->getModel()->setClient($client);
  34. $this->assertEquals($client, $this->getModel()->getClient());
  35. }
  36. public function setup()
  37. {
  38. $this->model = $this->getMockForAbstractClass('Transmission\Model\AbstractModel');
  39. }
  40. private function getModel()
  41. {
  42. return $this->model;
  43. }
  44. }