Skip to content
Permalink
Browse files

changes the test so that just \n line ending is supported

otherwise the test will be skipped
also some other reformats
  • Loading branch information...
TheFRedFox committed May 27, 2016
1 parent bedc932 commit ef802cddd9555fd4b78dd87380318fb2f569adea
@@ -222,21 +222,22 @@ public function testHmacSigning()
*
* @return void
*/
public function testRsaSigning() {
public function testRsaSigning()
{
$request = new Request();
$request->url('http://photos.example.net/photos')
->body([
'file' => 'vacaction.jpg',
'size' => 'original'
]);
$private_key_path = TEST_APP . DS . 'config' . DS . 'key.pem';
$privateKeyPath = TEST_APP . DS . 'config' . DS . 'key.pem';
$options = [
'method' => 'RSA-SHA1',
'consumerKey' => 'dpf43f3p2l4k3l03',
'nonce' => '13917289812797014437',
'timestamp' => '1196666512',
'private_key_file' => $private_key_path,
'privateKeyFile' => $privateKeyPath
];
$auth = new Oauth();
$auth->authentication($request, $options);
@@ -257,23 +258,24 @@ public function testRsaSigning() {
*
* @return void
*/
public function testRsaSigningWithPassphraseString() {
public function testRsaSigningWithPassphraseString()
{
$request = new Request();
$request->url('http://photos.example.net/photos')
->body([
'file' => 'vacaction.jpg',
'size' => 'original'
]);
$private_key_path = TEST_APP . DS . 'config' . DS . 'key_with_passphrase.pem';
$privateKeyPath = TEST_APP . DS . 'config' . DS . 'key_with_passphrase.pem';
$passphrase = 'fancy-cakephp-passphrase';
$options = [
'method' => 'RSA-SHA1',
'consumerKey' => 'dpf43f3p2l4k3l03',
'nonce' => '13917289812797014437',
'timestamp' => '1196666512',
'private_key_file' => $private_key_path,
'private_key_passphrase' => $passphrase,
'privateKeyFile' => $privateKeyPath,
'privateKeyPassphrase' => $passphrase,
];
$auth = new Oauth();
$auth->authentication($request, $options);
@@ -294,28 +296,31 @@ public function testRsaSigningWithPassphraseString() {
*
* @return void
*/
public function testRsaSigningWithPassphraseFile() {
public function testRsaSigningWithPassphraseFile()
{
$request = new Request();
$request->url('http://photos.example.net/photos')
->body([
'file' => 'vacaction.jpg',
'size' => 'original'
]);
$private_key_path = TEST_APP . DS . 'config' . DS . 'key_with_passphrase.pem';
$privateKeyPath = TEST_APP . DS . 'config' . DS . 'key_with_passphrase.pem';
if (PHP_EOL != "\n") {
$this->markTestSkipped('Just the line ending ("\n") is supported. You can run the test again e.g. on a linux system.');
return;
}
if(PHP_EOL == "\n") $passphrase_path = TEST_APP . DS . 'config' . DS . 'key_passphrase_lf';
else if(PHP_EOL == "\r\n") $passphrase_path = TEST_APP . DS . 'config' . DS . 'key_passphrase_crlf';
else if(PHP_EOL == "\r") $passphrase_path = TEST_APP . DS . 'config' . DS . 'key_passphrase_cr';
else { $this->markTestSkipped('The file for the key passphrase could not be loaded as PHP_EOL could not be recognized.'); return; }
$passphrase = fopen($passphrase_path, 'r');
$passphrasePath = TEST_APP . DS . 'config' . DS . 'key_passphrase_lf';
$passphrase = fopen($passphrasePath, 'r');
$options = [
'method' => 'RSA-SHA1',
'consumerKey' => 'dpf43f3p2l4k3l03',
'nonce' => '13917289812797014437',
'timestamp' => '1196666512',
'private_key_file' => $private_key_path,
'private_key_passphrase' => $passphrase,
'privateKeyFile' => $privateKeyPath,
'privateKeyPassphrase' => $passphrase,
];
$auth = new Oauth();
$auth->authentication($request, $options);

This file was deleted.

Oops, something went wrong.

This file was deleted.

Oops, something went wrong.

0 comments on commit ef802cd

Please sign in to comment.
You can’t perform that action at this time.