Tests are now compliant with php-cs-fixer (CamelCase for method, phpdoc valid)

This commit is contained in:
2023-04-13 22:22:46 +02:00
parent b017700d0a
commit 273db5f183
51 changed files with 3926 additions and 3637 deletions

View File

@@ -1,16 +1,19 @@
<?php
/** DomFramework - Tests
* @package domframework
* @author Dominique Fournier <dominique@fournier38.fr>
* @license BSD
*/
/**
* DomFramework - Tests
* @package domframework
* @author Dominique Fournier <dominique@fournier38.fr>
* @license BSD
*/
namespace Domframework\Tests;
use Domframework\File;
/** Test the domframework File part */
/**
* Test the domframework File part
*/
class FileTest extends \PHPUnit_Framework_TestCase
{
public function testinit()
@@ -303,7 +306,7 @@ class FileTest extends \PHPUnit_Framework_TestCase
$file->chdir("/tmp/testDFFileDir");
}
public function testFile_get_contents1()
public function testFileGetContents1()
{
$this->setExpectedException(
"Exception",
@@ -318,7 +321,7 @@ class FileTest extends \PHPUnit_Framework_TestCase
$res = $file->file_get_contents("/testDFFileDir");
}
public function testFile_get_contents2()
public function testFileGetContents2()
{
if (file_exists("/tmp/testDFFileDir")) {
rmdir("/tmp/testDFFileDir");
@@ -331,7 +334,7 @@ class FileTest extends \PHPUnit_Framework_TestCase
$this->assertSame($res, "");
}
public function testFile_put_contents1()
public function testFilePutContents1()
{
$file = new File();
$file->chroot("/tmp");
@@ -340,7 +343,7 @@ class FileTest extends \PHPUnit_Framework_TestCase
$this->assertSame($res, "content");
}
public function testFile_put_contents2()
public function testFilePutContents2()
{
$this->setExpectedException(
"Exception",
@@ -350,7 +353,7 @@ class FileTest extends \PHPUnit_Framework_TestCase
$file->file_put_contents("/tmp/testDFFileDir", "content");
}
public function testFile_put_contents3()
public function testFilePutContents3()
{
$file = new File();
$file->chroot("/tmp");
@@ -362,7 +365,7 @@ class FileTest extends \PHPUnit_Framework_TestCase
{
$file = new File();
$res = $file->scandir("/tmp/testDFFileDir");
$this->assertSame($res, array ("toto"));
$this->assertSame($res, ["toto"]);
}
public function testscandir2()
@@ -370,7 +373,7 @@ class FileTest extends \PHPUnit_Framework_TestCase
$file = new File();
$file->chroot("/tmp");
$res = $file->scandir("/testDFFileDir");
$this->assertSame($res, array ("toto"));
$this->assertSame($res, ["toto"]);
}
public function testscandir3()
@@ -378,12 +381,12 @@ class FileTest extends \PHPUnit_Framework_TestCase
$file = new File();
$file->chroot("/tmp");
$res = $file->scandir("/testDFFileDir/");
$this->assertSame($res, array ("toto"));
$this->assertSame($res, ["toto"]);
}
public function testrmdir1()
{
// Directory not empty and NOT recursive : return false
// Directory not empty and NOT recursive : return false
$file = new File();
$res = $file->rmdir("/tmp/testDFFileDir");
$this->assertSame($res, false);
@@ -391,7 +394,7 @@ class FileTest extends \PHPUnit_Framework_TestCase
public function testrmdir2()
{
// Directory not empty and NOT recursive : return false
// Directory not empty and NOT recursive : return false
$file = new File();
$file->chroot("/tmp");
$res = $file->rmdir("/testDFFileDir");
@@ -400,7 +403,7 @@ class FileTest extends \PHPUnit_Framework_TestCase
public function testrmdir3()
{
// Directory not empty and recursive : return true
// Directory not empty and recursive : return true
$file = new File();
$file->chroot("/tmp");
$res = $file->rmdir("/testDFFileDir", true);
@@ -459,7 +462,7 @@ class FileTest extends \PHPUnit_Framework_TestCase
{
$file = new File();
$file->chroot("/tmp");
// The parent doesn't exists and not recursive mode : exception
// The parent doesn't exists and not recursive mode : exception
$this->expectException();
$res = $file->mkdir("/testDFFileDir/tptp/titi/poo");
}
@@ -472,58 +475,58 @@ class FileTest extends \PHPUnit_Framework_TestCase
$this->assertSame($res, true);
}
public function test_glob_1()
public function testGlob1()
{
$file = new File();
$file->chroot("/tmp");
$res = $file->glob("/testDFFileDir/*");
$this->assertSame($res, array ("/testDFFileDir/toto",
"/testDFFileDir/tptp"));
$this->assertSame($res, ["/testDFFileDir/toto",
"/testDFFileDir/tptp"]);
}
public function test_glob_2()
public function testGlob2()
{
$file = new File();
$file->chroot("/tmp");
$file->chdir("/testDFFileDir");
$res = $file->glob("*");
$this->assertSame($res, array ("toto",
"tptp"));
$this->assertSame($res, ["toto",
"tptp"]);
}
public function test_glob_3()
public function testGlob3()
{
$file = new File();
$file->chroot("/tmp");
$file->chdir("/testDFFileDir");
$res = $file->glob("/testDFFileDir/*");
$this->assertSame($res, array ("/testDFFileDir/toto",
"/testDFFileDir/tptp"));
$this->assertSame($res, ["/testDFFileDir/toto",
"/testDFFileDir/tptp"]);
}
public function test_glob_4()
public function testGlob4()
{
$file = new File();
$res = $file->glob("/tmp/testDFFileDir/*");
$this->assertSame($res, array ("/tmp/testDFFileDir/toto",
"/tmp/testDFFileDir/tptp"));
$this->assertSame($res, ["/tmp/testDFFileDir/toto",
"/tmp/testDFFileDir/tptp"]);
}
public function test_glob_5()
public function testGlob5()
{
$file = new File();
$file->chdir("/tmp/testDFFileDir");
$res = $file->glob("*");
$this->assertSame($res, array ("toto",
"tptp"));
$this->assertSame($res, ["toto",
"tptp"]);
}
public function test_glob_6()
public function testGlob6()
{
$file = new File();
$file->chdir("/tmp/testDFFileDir");
$res = $file->glob("/tmp/testDFFileDir/*");
$this->assertSame($res, array ("/tmp/testDFFileDir/toto",
"/tmp/testDFFileDir/tptp"));
$this->assertSame($res, ["/tmp/testDFFileDir/toto",
"/tmp/testDFFileDir/tptp"]);
}
}