]> git.immae.eu Git - github/shaarli/Shaarli.git/blobdiff - tests/api/controllers/links/PostLinkTest.php
Merge tag 'v0.10.4' into stable
[github/shaarli/Shaarli.git] / tests / api / controllers / links / PostLinkTest.php
similarity index 94%
rename from tests/api/controllers/PostLinkTest.php
rename to tests/api/controllers/links/PostLinkTest.php
index 31954e396d2d95b56b24bb08f7fe1876ce83ed21..5c2b56232c4691529c0aa8ac96904a1c4ec9ec54 100644 (file)
@@ -2,12 +2,13 @@
 
 namespace Shaarli\Api\Controllers;
 
-
+use PHPUnit\Framework\TestCase;
 use Shaarli\Config\ConfigManager;
 use Slim\Container;
 use Slim\Http\Environment;
 use Slim\Http\Request;
 use Slim\Http\Response;
+use Slim\Router;
 
 /**
  * Class PostLinkTest
@@ -16,7 +17,7 @@ use Slim\Http\Response;
  *
  * @package Shaarli\Api\Controllers
  */
-class PostLinkTest extends \PHPUnit_Framework_TestCase
+class PostLinkTest extends TestCase
 {
     /**
      * @var string datastore to test write operations
@@ -78,7 +79,7 @@ class PostLinkTest extends \PHPUnit_Framework_TestCase
 
         $this->controller = new Links($this->container);
 
-        $mock = $this->getMock('\Slim\Router', ['relativePathFor']);
+        $mock = $this->createMock(Router::class);
         $mock->expects($this->any())
              ->method('relativePathFor')
              ->willReturn('api/v1/links/1');
@@ -126,7 +127,9 @@ class PostLinkTest extends \PHPUnit_Framework_TestCase
         $this->assertEquals('', $data['description']);
         $this->assertEquals([], $data['tags']);
         $this->assertEquals(false, $data['private']);
-        $this->assertTrue(new \DateTime('5 seconds ago') < \DateTime::createFromFormat(\DateTime::ATOM, $data['created']));
+        $this->assertTrue(
+            new \DateTime('5 seconds ago') < \DateTime::createFromFormat(\DateTime::ATOM, $data['created'])
+        );
         $this->assertEquals('', $data['updated']);
 
         $historyEntry = $this->history->getHistory()[0];
@@ -169,7 +172,9 @@ class PostLinkTest extends \PHPUnit_Framework_TestCase
         $this->assertEquals($link['description'], $data['description']);
         $this->assertEquals($link['tags'], $data['tags']);
         $this->assertEquals(true, $data['private']);
-        $this->assertTrue(new \DateTime('2 seconds ago') < \DateTime::createFromFormat(\DateTime::ATOM, $data['created']));
+        $this->assertTrue(
+            new \DateTime('2 seconds ago') < \DateTime::createFromFormat(\DateTime::ATOM, $data['created'])
+        );
         $this->assertEquals('', $data['updated']);
     }