Skip to content

Commit

Permalink
Update class names with ::class descriptor. Closes #143
Browse files Browse the repository at this point in the history
  • Loading branch information
gordalina committed Mar 29, 2020
1 parent 1db2179 commit 2f9de99
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 12 deletions.
7 changes: 4 additions & 3 deletions tests/Adapter/CliTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@
namespace CacheTool\Adapter;

use CacheTool\Code;
use \Monolog\Logger;

class CliTest extends \PHPUnit\Framework\TestCase
{
public function testRun()
{
$cli = new Cli();
$cli->setTempDir(sys_get_temp_dir());
$cli->setLogger($this->getMockBuilder('Monolog\Logger')->disableOriginalConstructor()->getMock());
$cli->setLogger($this->getMockBuilder(Logger::class)->disableOriginalConstructor()->getMock());

$code = Code::fromString('return true;');

Expand All @@ -25,7 +26,7 @@ public function testException()

$cli = new Cli();
$cli->setTempDir(sys_get_temp_dir());
$cli->setLogger($this->getMockBuilder('Monolog\Logger')->disableOriginalConstructor()->getMock());
$cli->setLogger($this->getMockBuilder(Logger::class)->disableOriginalConstructor()->getMock());

$code = Code::fromString('throw new \Exception("test");');
$result = $cli->run($code);
Expand All @@ -35,7 +36,7 @@ public function testPhpBinary()
{
$cli = new Cli();
$cli->setTempDir(sys_get_temp_dir());
$cli->setLogger($this->getMockBuilder('Monolog\Logger')->disableOriginalConstructor()->getMock());
$cli->setLogger($this->getMockBuilder(Logger::class)->disableOriginalConstructor()->getMock());

$code = Code::fromString('return PHP_BINARY;');

Expand Down
5 changes: 3 additions & 2 deletions tests/Adapter/FastCGITest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use \hollodotme\FastCGI\SocketConnections\NetworkSocket;
use \hollodotme\FastCGI\Requests\PostRequest;
use \hollodotme\FastCGI\Responses\Response;
use \Monolog\Logger;

class FastCGITest extends \PHPUnit\Framework\TestCase
{
Expand All @@ -15,7 +16,7 @@ public function testRun()
$fpm = new PhpFpmRunner();
$fcgi = new FastCGI($fpm->socket);
$fcgi->setTempDir(sys_get_temp_dir());
$fcgi->setLogger($this->getMockBuilder('Monolog\Logger')->disableOriginalConstructor()->getMock());
$fcgi->setLogger($this->getMockBuilder(Logger::class)->disableOriginalConstructor()->getMock());

$code = Code::fromString('return true;');

Expand Down Expand Up @@ -75,7 +76,7 @@ public function testRunWithChroot()
->willReturn($response);

$fcgi->setTempDir(sys_get_temp_dir());
$fcgi->setLogger($this->getMockBuilder('Monolog\Logger')->disableOriginalConstructor()->getMock());
$fcgi->setLogger($this->getMockBuilder(Logger::class)->disableOriginalConstructor()->getMock());

$code = Code::fromString('return true;');

Expand Down
5 changes: 3 additions & 2 deletions tests/Adapter/WebTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,20 @@
namespace CacheTool\Adapter;

use CacheTool\Code;
use CacheTool\Adapter\Http\FileGetContents;

class WebTest extends \PHPUnit\Framework\TestCase
{
public function testRun()
{
$httpMock = $this->getMockBuilder('CacheTool\Adapter\Http\FileGetContents')->disableOriginalConstructor()->getMock();
$httpMock = $this->getMockBuilder(FileGetContents::class)->disableOriginalConstructor()->getMock();
$httpMock
->method('fetch')
->willReturn(serialize(['errors' => [], 'result' => true]));

$web = new Web(sys_get_temp_dir(), $httpMock);
$web->setTempDir(sys_get_temp_dir());
$web->setLogger($this->getMockBuilder('Monolog\Logger')->disableOriginalConstructor()->getMock());
$web->setLogger($this->getMockBuilder(\Monolog\Logger::class)->disableOriginalConstructor()->getMock());

$code = Code::fromString('return true;');

Expand Down
4 changes: 2 additions & 2 deletions tests/CacheToolTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class CacheToolTest extends \PHPUnit\Framework\TestCase
public function testConstruct()
{
$cachetool = new CacheTool();
$this->assertInstanceOf('CacheTool\CacheTool', $cachetool);
$this->assertInstanceOf(CacheTool::class, $cachetool);
}

public function testFactory()
Expand Down Expand Up @@ -70,6 +70,6 @@ public function testWithInexistentTempDir() {

protected function getLogger()
{
return $this->getMockBuilder('Monolog\Logger')->disableOriginalConstructor()->getMock();
return $this->getMockBuilder(\Monolog\Logger::class)->disableOriginalConstructor()->getMock();
}
}
6 changes: 3 additions & 3 deletions tests/CodeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,14 @@ public function testCodeExecutable()
$this->assertTrue(strlen($result) > 0);

$unserialized = @unserialize($result);
$this->assertTrue(is_array($unserialized));
$this->assertIsArray($unserialized);

$this->assertCount(2, $unserialized);
$this->assertArrayHasKey('result', $unserialized);
$this->assertArrayHasKey('errors', $unserialized);

$this->assertSame(10, $unserialized['result']);
$this->assertTrue(is_array($unserialized['errors']));
$this->assertIsArray($unserialized['errors']);
$this->assertCount(0, $unserialized['errors']);
}

Expand Down Expand Up @@ -164,7 +164,7 @@ protected function getCodeResult($statements)
$this->assertTrue(strlen($result) > 0);

$unserialized = unserialize($result);
$this->assertTrue(is_array($unserialized));
$this->assertIsArray($unserialized);

$this->assertCount(2, $unserialized);
$this->assertArrayHasKey('result', $unserialized);
Expand Down

0 comments on commit 2f9de99

Please sign in to comment.