/** * Method to test loadAllInputs(). * * @return void * * @covers Windwalker\IO\Input::loadAllInputs */ public function testLoadAllInputs() { // Remove the following lines when you implement this test. $this->markTestSkipped('A bug that the static $loaded variable has benn set to true.....'); $instance = $this->newInstance(array()); TestHelper::setValue($instance, 'loaded', false); $inputs = TestHelper::getValue($instance, 'inputs'); $this->assertCount(0, $inputs); TestHelper::invoke($instance, 'loadAllInputs'); $inputs = TestHelper::getValue($instance, 'inputs'); $this->assertGreaterThan(0, count($inputs)); }
/** * testNormalizeContentType * * @return void * * @covers \Windwalker\Http\Response\AbstractContentTypeResponse::normalizeContentType */ public function testNormalizeContentType() { $this->assertEquals('text/plain', TestHelper::invoke($this->instance, 'normalizeContentType', 'Text/Plain')); }
/** * testFetch * * @return void * * @covers Windwalker\Model\Model::fetch */ public function testFetch() { $closure = function () { return array('id' => 213); }; $item = TestHelper::invoke($this->instance, 'fetch', 'test.item', $closure); $this->assertEquals($item, TestHelper::invoke($this->instance, 'getCache', 'test.item')); }
/** * Test the Windwalker\Input\Files::decodeData method. * * @return void * * @covers Windwalker\Input\Files::decodeData * @since 1.1.4 */ public function testDecodeData() { $data = array('n', 'ty', 'tm', 'e', 's'); $decoded = TestHelper::invoke($this->instance, 'decodeData', $data); $expected = array('name' => 'n', 'type' => 'ty', 'tmp_name' => 'tm', 'error' => 'e', 'size' => 's'); $this->assertEquals($expected, $decoded); $dataArr = array('first', 'second'); $data = array($dataArr, $dataArr, $dataArr, $dataArr, $dataArr); $decoded = TestHelper::invoke($this->instance, 'decodeData', $data); $expectedFirst = array('name' => 'first', 'type' => 'first', 'tmp_name' => 'first', 'error' => 'first', 'size' => 'first'); $expectedSecond = array('name' => 'second', 'type' => 'second', 'tmp_name' => 'second', 'error' => 'second', 'size' => 'second'); $expected = array($expectedFirst, $expectedSecond); $this->assertEquals($expected, $decoded); }
/** * Method to test StringInflector::setCache(). * * @return void * * @covers Windwalker\String\StringInflector::setCache * @since 1.0 */ public function testSetCache() { TestHelper::invoke($this->StringInflector, 'setCache', 'foo', 'bar'); $cache = TestHelper::getValue($this->StringInflector, 'cache'); $this->assertThat($cache['foo'], $this->equalTo('bar'), 'Checks the cache was set.'); TestHelper::invoke($this->StringInflector, 'setCache', 'foo', 'car'); $cache = TestHelper::getValue($this->StringInflector, 'cache'); $this->assertThat($cache['foo'], $this->equalTo('car'), 'Checks an existing value in the cache was reset.'); }