Merge pull request #6809 from ravage84/2.7-code-coverage

Explicit definition of the code coverage
This commit is contained in:
Mark Story 2015-06-15 10:13:12 -04:00
commit 32fe09835b

View file

@ -23,6 +23,7 @@ App::uses('Folder', 'Utility');
* FileTest class * FileTest class
* *
* @package Cake.Test.Case.Utility * @package Cake.Test.Case.Utility
* @coversDefaultClass File
*/ */
class FileTest extends CakeTestCase { class FileTest extends CakeTestCase {
@ -62,6 +63,15 @@ class FileTest extends CakeTestCase {
* testBasic method * testBasic method
* *
* @return void * @return void
* @covers ::__construct
* @covers ::info
* @covers ::ext
* @covers ::name
* @covers ::md5
* @covers ::size
* @covers ::owner
* @covers ::group
* @covers ::Folder
*/ */
public function testBasic() { public function testBasic() {
$file = CAKE . DS . 'LICENSE.txt'; $file = CAKE . DS . 'LICENSE.txt';
@ -126,6 +136,7 @@ class FileTest extends CakeTestCase {
* testPermission method * testPermission method
* *
* @return void * @return void
* @covers ::perms
*/ */
public function testPermission() { public function testPermission() {
$this->skipIf(DIRECTORY_SEPARATOR === '\\', 'File permissions tests not supported on Windows.'); $this->skipIf(DIRECTORY_SEPARATOR === '\\', 'File permissions tests not supported on Windows.');
@ -172,6 +183,7 @@ class FileTest extends CakeTestCase {
* testRead method * testRead method
* *
* @return void * @return void
* @covers ::read
*/ */
public function testRead() { public function testRead() {
$file = __FILE__; $file = __FILE__;
@ -203,6 +215,7 @@ class FileTest extends CakeTestCase {
* testOffset method * testOffset method
* *
* @return void * @return void
* @covers ::offset
*/ */
public function testOffset() { public function testOffset() {
$this->File->close(); $this->File->close();
@ -235,6 +248,7 @@ class FileTest extends CakeTestCase {
* testOpen method * testOpen method
* *
* @return void * @return void
* @covers ::open
*/ */
public function testOpen() { public function testOpen() {
$this->File->handle = null; $this->File->handle = null;
@ -259,6 +273,7 @@ class FileTest extends CakeTestCase {
* testClose method * testClose method
* *
* @return void * @return void
* @covers ::close
*/ */
public function testClose() { public function testClose() {
$this->File->handle = null; $this->File->handle = null;
@ -276,6 +291,9 @@ class FileTest extends CakeTestCase {
* testCreate method * testCreate method
* *
* @return void * @return void
* @covers ::create
* @covers ::exists
* @covers ::clearStatCache
*/ */
public function testCreate() { public function testCreate() {
$tmpFile = TMP . 'tests' . DS . 'cakephp.file.test.tmp'; $tmpFile = TMP . 'tests' . DS . 'cakephp.file.test.tmp';
@ -287,6 +305,8 @@ class FileTest extends CakeTestCase {
* testOpeningNonExistentFileCreatesIt method * testOpeningNonExistentFileCreatesIt method
* *
* @return void * @return void
* @covers ::open
* @covers ::create
*/ */
public function testOpeningNonExistentFileCreatesIt() { public function testOpeningNonExistentFileCreatesIt() {
$someFile = new File(TMP . 'some_file.txt', false); $someFile = new File(TMP . 'some_file.txt', false);
@ -300,6 +320,7 @@ class FileTest extends CakeTestCase {
* testPrepare method * testPrepare method
* *
* @return void * @return void
* @covers ::prepare
*/ */
public function testPrepare() { public function testPrepare() {
$string = "some\nvery\ncool\r\nteststring here\n\n\nfor\r\r\n\n\r\n\nhere"; $string = "some\nvery\ncool\r\nteststring here\n\n\nfor\r\r\n\n\r\n\nhere";
@ -320,6 +341,7 @@ class FileTest extends CakeTestCase {
* testReadable method * testReadable method
* *
* @return void * @return void
* @covers ::readable
*/ */
public function testReadable() { public function testReadable() {
$someFile = new File(TMP . 'some_file.txt', false); $someFile = new File(TMP . 'some_file.txt', false);
@ -333,6 +355,7 @@ class FileTest extends CakeTestCase {
* testWritable method * testWritable method
* *
* @return void * @return void
* @covers ::writable
*/ */
public function testWritable() { public function testWritable() {
$someFile = new File(TMP . 'some_file.txt', false); $someFile = new File(TMP . 'some_file.txt', false);
@ -346,6 +369,7 @@ class FileTest extends CakeTestCase {
* testExecutable method * testExecutable method
* *
* @return void * @return void
* @covers ::executable
*/ */
public function testExecutable() { public function testExecutable() {
$someFile = new File(TMP . 'some_file.txt', false); $someFile = new File(TMP . 'some_file.txt', false);
@ -359,6 +383,7 @@ class FileTest extends CakeTestCase {
* testLastAccess method * testLastAccess method
* *
* @return void * @return void
* @covers ::lastAccess
*/ */
public function testLastAccess() { public function testLastAccess() {
$someFile = new File(TMP . 'some_file.txt', false); $someFile = new File(TMP . 'some_file.txt', false);
@ -373,6 +398,7 @@ class FileTest extends CakeTestCase {
* testLastChange method * testLastChange method
* *
* @return void * @return void
* @covers ::lastChange
*/ */
public function testLastChange() { public function testLastChange() {
$someFile = new File(TMP . 'some_file.txt', false); $someFile = new File(TMP . 'some_file.txt', false);
@ -391,6 +417,7 @@ class FileTest extends CakeTestCase {
* testWrite method * testWrite method
* *
* @return void * @return void
* @covers ::write
*/ */
public function testWrite() { public function testWrite() {
if (!$tmpFile = $this->_getTmpFile()) { if (!$tmpFile = $this->_getTmpFile()) {
@ -421,6 +448,7 @@ class FileTest extends CakeTestCase {
* testAppend method * testAppend method
* *
* @return void * @return void
* @covers ::append
*/ */
public function testAppend() { public function testAppend() {
if (!$tmpFile = $this->_getTmpFile()) { if (!$tmpFile = $this->_getTmpFile()) {
@ -457,6 +485,7 @@ class FileTest extends CakeTestCase {
* testDelete method * testDelete method
* *
* @return void * @return void
* @covers ::delete
*/ */
public function testDelete() { public function testDelete() {
if (!$tmpFile = $this->_getTmpFile()) { if (!$tmpFile = $this->_getTmpFile()) {
@ -482,6 +511,7 @@ class FileTest extends CakeTestCase {
* active filehandles open. * active filehandles open.
* *
* @return void * @return void
* @covers ::delete
*/ */
public function testDeleteAfterRead() { public function testDeleteAfterRead() {
if (!$tmpFile = $this->_getTmpFile()) { if (!$tmpFile = $this->_getTmpFile()) {
@ -499,6 +529,7 @@ class FileTest extends CakeTestCase {
* testCopy method * testCopy method
* *
* @return void * @return void
* @covers ::copy
*/ */
public function testCopy() { public function testCopy() {
$dest = TMP . 'tests' . DS . 'cakephp.file.test.tmp'; $dest = TMP . 'tests' . DS . 'cakephp.file.test.tmp';
@ -527,6 +558,7 @@ class FileTest extends CakeTestCase {
* Test mime() * Test mime()
* *
* @return void * @return void
* @covers ::mime
*/ */
public function testMime() { public function testMime() {
$this->skipIf(!function_exists('finfo_open') && !function_exists('mime_content_type'), 'Not able to read mime type'); $this->skipIf(!function_exists('finfo_open') && !function_exists('mime_content_type'), 'Not able to read mime type');
@ -566,6 +598,7 @@ class FileTest extends CakeTestCase {
* testReplaceText method * testReplaceText method
* *
* @return void * @return void
* @covers ::replaceText
*/ */
public function testReplaceText() { public function testReplaceText() {
$TestFile = new File(dirname(__FILE__) . '/../../test_app/Vendor/welcome.php'); $TestFile = new File(dirname(__FILE__) . '/../../test_app/Vendor/welcome.php');
@ -603,6 +636,7 @@ class FileTest extends CakeTestCase {
* do not exist. * do not exist.
* *
* @return void * @return void
* @covers ::pwd
*/ */
public function testNoPartialPathBeingSetForNonExistentPath() { public function testNoPartialPathBeingSetForNonExistentPath() {
$tmpFile = new File('/non/existent/file'); $tmpFile = new File('/non/existent/file');