Skip to content

Commit

Permalink
[4.0] PHPUnit test fixes (#14084)
Browse files Browse the repository at this point in the history
* [4.0] PHPUnit test fixes

* [4.0] PHPUnit create a new JMediawiki http instance instead of jhttp

* Fixed JDocumentFeedTest
  • Loading branch information
yvesh authored and zero-24 committed Feb 17, 2017
1 parent 722ba93 commit 6445be4
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
11 changes: 6 additions & 5 deletions tests/unit/suites/libraries/cms/router/JRouterSiteTest.php
Expand Up @@ -114,12 +114,13 @@ public function testConstruct()
$app->method('get')->will($this->returnValueMap($config));
$object = new JRouterSite($app, $app->getMenu());
$rules = $object->getRules();
$this->assertTrue(count($rules['parse' . JRouter::PROCESS_BEFORE]) == 3);
$this->assertTrue(count($rules['parse']) == 2);
$this->assertTrue(count($rules['parse' . JRouter::PROCESS_AFTER]) == 1);

$this->assertTrue(count($rules['parse' . JRouter::PROCESS_BEFORE]) == 2);
$this->assertTrue(count($rules['parse']) == 1);
$this->assertTrue(count($rules['parse' . JRouter::PROCESS_AFTER]) == 0);
$this->assertTrue(count($rules['build' . JRouter::PROCESS_BEFORE]) == 2);
$this->assertTrue(count($rules['build']) == 1);
$this->assertTrue(count($rules['build' . JRouter::PROCESS_AFTER]) == 4);
$this->assertTrue(count($rules['build']) == 0);
$this->assertTrue(count($rules['build' . JRouter::PROCESS_AFTER]) == 1);
}

/**
Expand Down
Expand Up @@ -27,7 +27,12 @@ protected function setUp()

$this->saveFactoryState();

JFactory::$application = $this->getMockWeb();
$config = array(
array('offset', 'UTC', 'UTC')
);

JFactory::$application = $this->getMockCmsApp();
JFactory::$application->method('get')->will($this->returnValueMap($config));

$this->object = new JDocumentFeed;
}
Expand Down
Expand Up @@ -36,7 +36,7 @@ public function testConstructorDisallowsNonArrayObjects()
*/
public function testConstructorSetsStreamTransport()
{
$http = new JHttp;
$http = new JMediawikiHttp(array());

$this->assertAttributeInstanceOf('JHttpTransportStream', 'transport', $http);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/suites/libraries/joomla/table/JTableTest.php
Expand Up @@ -204,7 +204,7 @@ public function testAddIncludePath()
$expected = array(
'/dummy/',
'dir/not/exist',
realpath(JPATH_PLATFORM . '/src/Joomla/Cms/Table')
realpath(JPATH_PLATFORM . '/src/Cms/Table')
);

// Add dummy paths
Expand Down

0 comments on commit 6445be4

Please sign in to comment.