Skip to content

Commit

Permalink
Merge branch 'hotfix/5369'
Browse files Browse the repository at this point in the history
  • Loading branch information
weierophinney committed Oct 30, 2013
2 parents e69e32a + cd4ab44 commit e0ee2ea
Show file tree
Hide file tree
Showing 13 changed files with 62 additions and 48 deletions.
2 changes: 2 additions & 0 deletions tests/ZendTest/Config/Writer/XmlTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public function testToString()
ECS;

$expected = str_replace("\r\n", "\n", $expected);
$this->assertEquals($expected, $configString);
}

Expand Down Expand Up @@ -78,6 +79,7 @@ public function testSectionsToString()
ECS;

$expected = str_replace("\r\n", "\n", $expected);
$this->assertEquals($expected, $configString);
}
}
18 changes: 9 additions & 9 deletions tests/ZendTest/Console/Prompt/NumberTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ public function testCanReadNumber()

public function testCanReadNumberOnMultilign()
{
fwrite($this->adapter->stream, "a\n");
fwrite($this->adapter->stream, "123\n");
fwrite($this->adapter->stream, "a" . PHP_EOL);
fwrite($this->adapter->stream, "123" . PHP_EOL);
rewind($this->adapter->stream);
$this->adapter->autoRewind = false;

Expand All @@ -64,8 +64,8 @@ public function testCanReadNumberOnMultilign()

public function testCanNotReadFloatByDefault()
{
fwrite($this->adapter->stream, "1.23\n");
fwrite($this->adapter->stream, "123\n");
fwrite($this->adapter->stream, "1.23" . PHP_EOL);
fwrite($this->adapter->stream, "123" . PHP_EOL);
rewind($this->adapter->stream);
$this->adapter->autoRewind = false;

Expand All @@ -80,8 +80,8 @@ public function testCanNotReadFloatByDefault()

public function testCanForceToReadFloat()
{
fwrite($this->adapter->stream, "1.23\n");
fwrite($this->adapter->stream, "123\n");
fwrite($this->adapter->stream, "1.23" . PHP_EOL);
fwrite($this->adapter->stream, "123" . PHP_EOL);
rewind($this->adapter->stream);
$this->adapter->autoRewind = false;

Expand All @@ -96,9 +96,9 @@ public function testCanForceToReadFloat()

public function testCanDefineAMax()
{
fwrite($this->adapter->stream, "1\n");
fwrite($this->adapter->stream, "11\n");
fwrite($this->adapter->stream, "6\n");
fwrite($this->adapter->stream, "1" . PHP_EOL);
fwrite($this->adapter->stream, "11" . PHP_EOL);
fwrite($this->adapter->stream, "6" . PHP_EOL);
rewind($this->adapter->stream);
$this->adapter->autoRewind = false;

Expand Down
14 changes: 7 additions & 7 deletions tests/ZendTest/Crypt/Key/Derivation/ScryptTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@ public function testVectorSalsa208Core()
}
$salsa20 = self::getMethod($salsaAlg);
$obj = $this->getMockForAbstractClass('Zend\Crypt\Key\Derivation\Scrypt');
$input = self::hex2bin(str_replace(array(' ',"\n"),'',$hexInput));
$input = self::hex2bin(str_replace(array(' ',PHP_EOL),'',$hexInput));
$result = $salsa20->invokeArgs($obj, array($input));

$this->assertEquals(64, strlen($input), 'Input must be a string of 64 bytes');
$this->assertEquals(64, strlen($result), 'Output must be a string of 64 bytes');
$this->assertEquals(str_replace(array(' ',"\n"),'',$hexOutput), bin2hex($result));
$this->assertEquals(str_replace(array(' ',PHP_EOL),'',$hexOutput), bin2hex($result));
}
/**
* Test vector of Scrypt BlockMix
Expand Down Expand Up @@ -85,10 +85,10 @@ public function testVectorScryptBlockMix()

$blockMix = self::getMethod('scryptBlockMix');
$obj = $this->getMockForAbstractClass('Zend\Crypt\Key\Derivation\Scrypt');
$input = self::hex2bin(str_replace(array(' ',"\n"), '', $hexInput));
$input = self::hex2bin(str_replace(array(' ',PHP_EOL), '', $hexInput));
$result = $blockMix->invokeArgs($obj, array($input, 1));

$this->assertEquals(str_replace(array(' ',"\n"),'',$hexOutput), bin2hex($result));
$this->assertEquals(str_replace(array(' ',PHP_EOL),'',$hexOutput), bin2hex($result));
}

/**
Expand Down Expand Up @@ -119,10 +119,10 @@ public function testVectorScryptROMix()

$roMix = self::getMethod('scryptROMix');
$obj = $this->getMockForAbstractClass('Zend\Crypt\Key\Derivation\Scrypt');
$input = self::hex2bin(str_replace(array(' ',"\n"), '', $hexInput));
$input = self::hex2bin(str_replace(array(' ',PHP_EOL), '', $hexInput));
$result = $roMix->invokeArgs($obj, array($input, 16, 1));

$this->assertEquals(str_replace(array(' ',"\n"),'',$hexOutput), bin2hex($result));
$this->assertEquals(str_replace(array(' ',PHP_EOL),'',$hexOutput), bin2hex($result));
}


Expand All @@ -140,7 +140,7 @@ public function testVectorScrypt()

$result = Scrypt::calc('', '', 16, 1, 1, 64);
$this->assertEquals(64, strlen($result));
$this->assertEquals(str_replace(array(' ',"\n"),'',$hexOutput), bin2hex($result));
$this->assertEquals(str_replace(array(' ',PHP_EOL),'',$hexOutput), bin2hex($result));
}

/**
Expand Down
1 change: 1 addition & 0 deletions tests/ZendTest/Db/Sql/Ddl/AlterTableTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ public function testGetSqlString()
DROP CONSTRAINT "my_index"
EOS;

$expected = str_replace("\r\n", "\n", $expected);
$this->assertEquals($expected, $at->getSqlString());
}
}
4 changes: 3 additions & 1 deletion tests/ZendTest/Feed/Reader/Entry/CommonTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ public function testSaveXmlOutputsXmlStringForEntry()
file_get_contents($this->feedSamplePath.'/atom.xml')
);
$entry = $feed->current();
$this->assertEquals($entry->saveXml(), file_get_contents($this->feedSamplePath.'/atom_rewrittenbydom.xml'));
$expected = file_get_contents($this->feedSamplePath.'/atom_rewrittenbydom.xml');
$expected = str_replace("\r\n", "\n", $expected);
$this->assertEquals($expected, $entry->saveXml());
}

public function testGetsNamedExtension()
Expand Down
4 changes: 3 additions & 1 deletion tests/ZendTest/Feed/Reader/Feed/CommonTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ public function testSaveXmlOutputsXmlStringForFeed()
$feed = Reader\Reader::importString(
file_get_contents($this->feedSamplePath.'/atom.xml')
);
$this->assertEquals($feed->saveXml(), file_get_contents($this->feedSamplePath.'/atom_rewrittenbydom.xml'));
$expected = file_get_contents($this->feedSamplePath.'/atom_rewrittenbydom.xml');
$expected = str_replace("\r\n", "\n", $expected);
$this->assertEquals($expected, $feed->saveXml());
}

public function testGetsNamedExtension()
Expand Down
24 changes: 16 additions & 8 deletions tests/ZendTest/Feed/Reader/Integration/PodcastRss2Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,12 @@ public function testGetsDescription()
$feed = Reader\Reader::importString(
file_get_contents($this->feedSamplePath)
);
$this->assertEquals('All About Everything is a show about everything.
$expected = 'All About Everything is a show about everything.
Each week we dive into any subject known to man and talk
about it as much as we can. Look for our Podcast in the
iTunes Store', $feed->getDescription());
iTunes Store';
$expected = str_replace("\r\n", "\n", $expected);
$this->assertEquals($expected, $feed->getDescription());
}

public function testGetsLanguage()
Expand Down Expand Up @@ -205,8 +207,10 @@ public function testGetsSubtitle()
file_get_contents($this->feedSamplePath)
);
$entry = $feed->current();
$this->assertEquals('A short primer on table spices
', $entry->getSubtitle());
$expected = 'A short primer on table spices
';
$expected = str_replace("\r\n", "\n", $expected);
$this->assertEquals($expected, $entry->getSubtitle());
}

public function testGetsSummary()
Expand All @@ -215,10 +219,12 @@ public function testGetsSummary()
file_get_contents($this->feedSamplePath)
);
$entry = $feed->current();
$this->assertEquals('This week we talk about salt and pepper
$expected = 'This week we talk about salt and pepper
shakers, comparing and contrasting pour rates,
construction materials, and overall aesthetics. Come and
join the party!', $entry->getSummary());
join the party!';
$expected = str_replace("\r\n", "\n", $expected);
$this->assertEquals($expected, $entry->getSummary());
}

public function testGetsDuration()
Expand All @@ -236,8 +242,10 @@ public function testGetsKeywords()
file_get_contents($this->feedSamplePath)
);
$entry = $feed->current();
$this->assertEquals('salt, pepper, shaker, exciting
', $entry->getKeywords());
$expected = 'salt, pepper, shaker, exciting
';
$expected = str_replace("\r\n", "\n", $expected);
$this->assertEquals($expected, $entry->getKeywords());
}

public function testGetsEntryEncoding()
Expand Down
5 changes: 5 additions & 0 deletions tests/ZendTest/Feed/Reader/ReaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,11 @@ public function testRegistersUserExtension()
$this->assertTrue(Reader\Reader::isRegistered('JungleBooks'));
}

/**
* This test is failing on windows:
* Failed asserting that exception of type "Zend\Feed\Reader\Exception\RuntimeException" matches expected exception "Zend\Feed\Reader\Exception\InvalidArgumentException". Message was: "DOMDocument cannot parse XML: Entity 'discloseInfo' failed to parse".
* @todo why is the assertEquals commented out?
*/
public function testXxePreventionOnFeedParsing()
{
$this->setExpectedException('Zend\Feed\Reader\Exception\InvalidArgumentException');
Expand Down
2 changes: 2 additions & 0 deletions tests/ZendTest/Feed/Writer/FeedTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1021,6 +1021,7 @@ public function testExportRss()

EOT;
$feed = str_replace('%version%', Version::VERSION, $feed);
$feed = str_replace("\r\n", "\n", $feed);
$this->assertEquals($feed, $export);
}

Expand All @@ -1042,6 +1043,7 @@ public function testExportRssIgnoreExceptions()

EOT;
$feed = str_replace('%version%', Version::VERSION, $feed);
$feed = str_replace("\r\n", "\n", $feed);
$this->assertEquals($feed, $export);
}

Expand Down
2 changes: 1 addition & 1 deletion tests/ZendTest/Filter/Compress/ZipTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function setUp()
$this->markTestSkipped('This adapter needs the zip extension');
}

$this->tmp = sys_get_temp_dir() . '/' . str_replace('\\', '_', __CLASS__);
$this->tmp = sys_get_temp_dir() . DIRECTORY_SEPARATOR . str_replace('\\', '_', __CLASS__);

$files = array(
$this->tmp . '/compressed.zip',
Expand Down
4 changes: 2 additions & 2 deletions tests/ZendTest/Filter/File/RenameTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ public function testGetRandomizedFile()
$filter->getFile()
);
$fileNoExt = $this->_filesPath . 'newfile';
$this->assertRegExp('#' . $fileNoExt . '_.{13}\.xml#', $filter->getNewName($this->_oldFile));
$this->assertRegExp('#' . str_replace('\\', '\\\\', $fileNoExt) . '_.{13}\.xml#', $filter->getNewName($this->_oldFile));
}

/**
Expand All @@ -515,7 +515,7 @@ public function testGetRandomizedFileWithoutExtension()
)),
$filter->getFile()
);
$this->assertRegExp('#' . $fileNoExt . '_.{13}#', $filter->getNewName($this->_oldFile));
$this->assertRegExp('#' . str_replace('\\', '\\\\', $fileNoExt) . '_.{13}#', $filter->getNewName($this->_oldFile));
}

/**
Expand Down
22 changes: 11 additions & 11 deletions tests/ZendTest/Filter/File/RenameUploadTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ public function setUp()
mkdir($this->_filesPath);
mkdir($this->_newDir);

$this->_oldFile = $this->_filesPath . '/testfile.txt';
$this->_newFile = $this->_filesPath . '/newfile.xml';
$this->_newDirFile = $this->_newDir . '/testfile.txt';
$this->_oldFile = $this->_filesPath . DIRECTORY_SEPARATOR . 'testfile.txt';
$this->_newFile = $this->_filesPath . DIRECTORY_SEPARATOR . 'newfile.xml';
$this->_newDirFile = $this->_newDir . DIRECTORY_SEPARATOR . 'testfile.txt';

touch($this->_oldFile);
}
Expand Down Expand Up @@ -245,18 +245,18 @@ public function testCannotOverwriteExistingFile()
*/
public function testGetRandomizedFile()
{
$fileNoExt = $this->_filesPath . '/newfile';
$fileNoExt = $this->_filesPath . DIRECTORY_SEPARATOR . 'newfile';
$filter = new RenameUploadMock(array(
'target' => $this->_newFile,
'randomize' => true,
));

$this->assertRegExp('#' . $fileNoExt . '_.{13}\.xml#', $filter($this->_oldFile));
$this->assertRegExp('#' . str_replace('\\', '\\\\', $fileNoExt) . '_.{13}\.xml#', $filter($this->_oldFile));
}

public function testGetFileWithOriginalExtension()
{
$fileNoExt = $this->_filesPath . '/newfile';
$fileNoExt = $this->_filesPath . DIRECTORY_SEPARATOR . 'newfile';
$filter = new RenameUploadMock(array(
'target' => $this->_newFile,
'use_upload_extension' => true,
Expand All @@ -266,14 +266,14 @@ public function testGetFileWithOriginalExtension()
$oldFilePathInfo = pathinfo($this->_oldFile);

$this->assertRegExp(
'#' . $fileNoExt . '.'.$oldFilePathInfo['extension'].'#',
'#' . str_replace('\\', '\\\\', $fileNoExt) . '.'.$oldFilePathInfo['extension'].'#',
$filter($this->_oldFile)
);
}

public function testGetRandomizedFileWithOriginalExtension()
{
$fileNoExt = $this->_filesPath . '/newfile';
$fileNoExt = $this->_filesPath . DIRECTORY_SEPARATOR . 'newfile';
$filter = new RenameUploadMock(array(
'target' => $this->_newFile,
'use_upload_extension' => true,
Expand All @@ -283,7 +283,7 @@ public function testGetRandomizedFileWithOriginalExtension()
$oldFilePathInfo = pathinfo($this->_oldFile);

$this->assertRegExp(
'#' . $fileNoExt . '_.{13}\.'.$oldFilePathInfo['extension'].'#',
'#' . str_replace('\\', '\\\\', $fileNoExt) . '_.{13}\.'.$oldFilePathInfo['extension'].'#',
$filter($this->_oldFile)
);
}
Expand All @@ -293,13 +293,13 @@ public function testGetRandomizedFileWithOriginalExtension()
*/
public function testGetRandomizedFileWithoutExtension()
{
$fileNoExt = $this->_filesPath . '/newfile';
$fileNoExt = $this->_filesPath . DIRECTORY_SEPARATOR . 'newfile';
$filter = new RenameUploadMock(array(
'target' => $fileNoExt,
'randomize' => true,
));

$this->assertRegExp('#' . $fileNoExt . '_.{13}#', $filter($this->_oldFile));
$this->assertRegExp('#' . str_replace('\\', '\\\\', $fileNoExt) . '_.{13}#', $filter($this->_oldFile));
}

/**
Expand Down
8 changes: 0 additions & 8 deletions tests/ZendTest/Soap/ClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,6 @@

require_once __DIR__ . '/TestAsset/commontypes.php';

//if soap exension is not loaded, this will avoid two notices in the test runner suite
if(!defined('SOAP_ENCODED')){
define ('SOAP_ENCODED', 1);
}
if(!defined('SOAP_DOCUMENT')){
define ('SOAP_DOCUMENT', 2);
}

use Zend\Soap\AutoDiscover;
use Zend\Soap\Client;
use Zend\Soap\Server;
Expand Down

0 comments on commit e0ee2ea

Please sign in to comment.