Skip to content

Commit

Permalink
Some improvements in tests #2: (joomla#13398)
Browse files Browse the repository at this point in the history
* Some improvements in tests #2:
- fix callable name mismatches
- removed closing tags (also one that's in other PR, to not clash)
- removed loop that does nothing

* Revert removal of empty loop, as $i is decremented in the while statement
  • Loading branch information
frankmayer authored and wilsonge committed Dec 29, 2016
1 parent 3f400e6 commit 7aa43fd
Show file tree
Hide file tree
Showing 14 changed files with 23 additions and 23 deletions.
2 changes: 1 addition & 1 deletion tests/unit/core/case/case.php
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ public function setExpectedError($error = null)
*/
protected function restoreErrorHandlers()
{
$this->setErrorhandlers($this->_stashedErrorState);
$this->setErrorHandlers($this->_stashedErrorState);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/stubs/discover1/challenger.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php /* @codingStandardsIgnoreFile Empty file */ ?>
<?php /* @codingStandardsIgnoreFile Empty file */
2 changes: 1 addition & 1 deletion tests/unit/stubs/discover1/columbia.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php /* @codingStandardsIgnoreFile Empty file */ ?>
<?php /* @codingStandardsIgnoreFile Empty file */
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,6 @@ protected function tearDown()
{
$this->restoreFactoryState();
unset($this->_instance);
parent::teardown();
parent::tearDown();
}
}
2 changes: 1 addition & 1 deletion tests/unit/suites/libraries/joomla/feed/JFeedEntryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,6 @@ protected function tearDown()
{
unset($this->_instance);

parent::teardown();
parent::tearDown();
}
}
14 changes: 7 additions & 7 deletions tests/unit/suites/libraries/joomla/feed/JFeedParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function testParse()

// Set the XML for the internal reader and move the stream to the <root> element.
$xml = '<root xmlns="http://bar.foo" xmlns:namespace="http://foo.bar"><tag1>foobar</tag1><namespace:tag2 attr="value" /></root>';
$this->_reader->Xml($xml);
$this->_reader->XML($xml);

// Advance the reader to the first <tag1> element.
do
Expand Down Expand Up @@ -207,7 +207,7 @@ public function testFetchNamespace()
public function testMoveToNextElement()
{
// Set the XML for the internal reader and move the stream to the <root> element.
$this->_reader->Xml('<root><node test="first"><child>foobar</child></node><node test="second"></node></root>');
$this->_reader->XML('<root><node test="first"><child>foobar</child></node><node test="second"></node></root>');
$this->_reader->next('root');

// Ensure that the current node is "root".
Expand Down Expand Up @@ -243,7 +243,7 @@ public function testMoveToNextElement()
public function testMoveToNextElementByName()
{
// Set the XML for the internal reader and move the stream to the <root> element.
$this->_reader->Xml('<root><node test="first"><child>foobar</child></node><node test="second"></node></root>');
$this->_reader->XML('<root><node test="first"><child>foobar</child></node><node test="second"></node></root>');

// Move to the next <node> element, which should be <node test="first">.
TestReflection::invoke($this->_instance, 'moveToNextElement', 'node');
Expand All @@ -266,7 +266,7 @@ public function testMoveToNextElementByName()
public function testMoveToClosingElement()
{
// Set the XML for the internal reader and move the stream to the <root> element.
$this->_reader->Xml('<root><child>foobar</child></root>');
$this->_reader->XML('<root><child>foobar</child></root>');
$this->_reader->next('root');

// Ensure that the current node is "root".
Expand All @@ -288,7 +288,7 @@ public function testMoveToClosingElement()
public function testMoveToClosingElementWithInternalElements()
{
// Set the XML for the internal reader and move the stream to the first <node> element.
$this->_reader->Xml('<root><node test="first"><child>foobar</child></node><node test="second"></node></root>');
$this->_reader->XML('<root><node test="first"><child>foobar</child></node><node test="second"></node></root>');

// Advance the reader to the first <node> element.
do
Expand Down Expand Up @@ -335,7 +335,7 @@ public function testMoveToClosingElementWithInternalElements()
public function testMoveToClosingElementWithSelfClosingTag()
{
// Set the XML for the internal reader and move the stream to the first <node> element.
$this->_reader->Xml('<root><node test="first" /><node test="second"></node></root>');
$this->_reader->XML('<root><node test="first" /><node test="second"></node></root>');

// Advance the reader to the first <node> element.
do
Expand Down Expand Up @@ -399,6 +399,6 @@ protected function tearDown()
unset($this->_instance);
unset($this->_reader);

parent::teardown();
parent::tearDown();
}
}
2 changes: 1 addition & 1 deletion tests/unit/suites/libraries/joomla/feed/JFeedTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,6 @@ protected function tearDown()
{
unset($this->_instance);

parent::teardown();
parent::tearDown();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ public function testHandleUpdated()
public function testInitialise($expected, $xml)
{
// Set the XML for the internal reader.
$this->_reader->Xml($xml);
$this->_reader->XML($xml);

// Advance the reader to the first element.
do
Expand Down Expand Up @@ -329,6 +329,6 @@ protected function tearDown()
unset($this->_instance);
unset($this->_reader);

parent::teardown();
parent::tearDown();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ public function testHandleWebmaster()
public function testInitialise($expected, $xml)
{
// Set the XML for the internal reader.
$this->_reader->Xml($xml);
$this->_reader->XML($xml);

// Advance the reader to the first element.
do
Expand Down Expand Up @@ -576,6 +576,6 @@ protected function tearDown()
unset($this->_instance);
unset($this->_reader);

parent::teardown();
parent::tearDown();
}
}
4 changes: 2 additions & 2 deletions tests/unit/suites/libraries/joomla/form/JFormTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ private function _showXml($form)
$dom = new DOMDocument('1.0');
$dom->preserveWhiteSpace = false;
$dom->formatOutput = true;
$dom->loadXml($form->getXml()->asXml());
echo $dom->saveXml();
$dom->loadXML($form->getXml()->asXml());
echo $dom->saveXML();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ public function testGenerateReport()
$timezone = new DateTimeZone('Europe/London');
$start = new DateTime('now');
$end = new DateTime;
$end->setTimestamp(time() + 3600)->setTimeZone($timezone);
$end->setTimestamp(time() + 3600)->setTimezone($timezone);

$result = $this->object->generateReport('accountID', time(), time() + 100000, array('option' => 'value'));
$this->assertEquals($result, array('rows' => array(1, 2), 'totalMatchedRows' => 1));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ public function testCreateEvent()
$timezone = new DateTimeZone('Europe/London');
$start = new DateTime('now');
$end = new DateTime;
$end->setTimestamp(time() + 3600)->setTimeZone($timezone);
$end->setTimestamp(time() + 3600)->setTimezone($timezone);

$result = $this->object->createEvent('calendarID', time(), time() + 100000, array('option' => 'value'));
$this->assertEquals($result, array('items' => array('1' => 1, '2' => 2)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,6 @@ protected function tearDown()
{
$this->restoreFactoryState();
unset($this->_instance);
parent::teardown();
parent::tearDown();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -785,7 +785,7 @@ protected function getDataSet()
*/
protected function setUp()
{
parent::setup();
parent::setUp();

// $this->saveFactoryState();

Expand Down

0 comments on commit 7aa43fd

Please sign in to comment.