Skip to content

Commit

Permalink
Fix Phramework::getRequestUUID method
Browse files Browse the repository at this point in the history
  • Loading branch information
nohponex committed Jan 4, 2016
1 parent 2ed9ce9 commit 62b3be5
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Phramework.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class Phramework
* UUID generated for this request
* @var string
*/
protected $requestUUID;
protected static $requestUUID;

/**
* Viewer class
Expand Down
60 changes: 60 additions & 0 deletions tests/src/PhrameworkTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<?php
/**
* Copyright 2015 Xenofon Spafaridis
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace Phramework;

/**
* @license https://www.apache.org/licenses/LICENSE-2.0 Apache-2.0
* @author Xenofon Spafaridis <nohponex@gmail.com>
*/
class PhrameworkTest extends \PHPUnit_Framework_TestCase
{
/**
* @var Phramework
*/
protected $phramework;

/**
* This method is called before a test is executed.
*/
public function setUp()
{
//Prepare phramework instance
$this->phramework = new Phramework(
[],
new \Phramework\URIStrategy\URITemplate([
])
);
}

/**
* @covers Phramework\Phramework::getRequestUUID
*/
public function testGetRequestUUID()
{
$requestUUID = Phramework::getRequestUUID();

$this->assertInternalType('string', $requestUUID);

$this->assertSame(36, strlen($requestUUID), 'Must be 36 characters');

$this->assertSame(
$requestUUID,
Phramework::getRequestUUID(),
'Two requests must return same UUID'
);
}
}

0 comments on commit 62b3be5

Please sign in to comment.