AbstractConsumerTest.php
2 years ago
CurlConsumerTest.php
2 years ago
FileConsumerTest.php
2 years ago
SocketConsumerTest.php
2 years ago
index.php
2 years ago
FileConsumerTest.php
24 lines
| 1 | <?php |
| 2 | if (!defined('ABSPATH')) exit; |
| 3 | class ConsumerStrategies_FileConsumerTest extends PHPUnit_Framework_TestCase { |
| 4 | protected $_instance = null; |
| 5 | protected $_file = null; |
| 6 | protected function setUp() |
| 7 | { |
| 8 | parent::setUp(); |
| 9 | $this->_file = dirname(__FILE__)."/output-".time().".txt"; |
| 10 | $this->_instance = new ConsumerStrategies_FileConsumer(array("file" => $this->_file)); |
| 11 | } |
| 12 | protected function tearDown() |
| 13 | { |
| 14 | parent::tearDown(); |
| 15 | $this->_instance = null; |
| 16 | @unlink($this->_file); |
| 17 | } |
| 18 | public function testPersist() { |
| 19 | $this->_instance->persist(array("msg")); |
| 20 | $contents = file_get_contents($this->_file); |
| 21 | $this->assertEquals('["msg"]'."\n", $contents); |
| 22 | } |
| 23 | } |
| 24 |