aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/api/controllers/links/PostLinkTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/api/controllers/links/PostLinkTest.php')
-rw-r--r--tests/api/controllers/links/PostLinkTest.php14
1 files changed, 7 insertions, 7 deletions
diff --git a/tests/api/controllers/links/PostLinkTest.php b/tests/api/controllers/links/PostLinkTest.php
index 4e791a04..20694571 100644
--- a/tests/api/controllers/links/PostLinkTest.php
+++ b/tests/api/controllers/links/PostLinkTest.php
@@ -2,11 +2,11 @@
2 2
3namespace Shaarli\Api\Controllers; 3namespace Shaarli\Api\Controllers;
4 4
5use PHPUnit\Framework\TestCase;
6use Shaarli\Bookmark\Bookmark; 5use Shaarli\Bookmark\Bookmark;
7use Shaarli\Bookmark\BookmarkFileService; 6use Shaarli\Bookmark\BookmarkFileService;
8use Shaarli\Config\ConfigManager; 7use Shaarli\Config\ConfigManager;
9use Shaarli\History; 8use Shaarli\History;
9use Shaarli\TestCase;
10use Slim\Container; 10use Slim\Container;
11use Slim\Http\Environment; 11use Slim\Http\Environment;
12use Slim\Http\Request; 12use Slim\Http\Request;
@@ -70,7 +70,7 @@ class PostLinkTest extends TestCase
70 /** 70 /**
71 * Before every test, instantiate a new Api with its config, plugins and bookmarks. 71 * Before every test, instantiate a new Api with its config, plugins and bookmarks.
72 */ 72 */
73 public function setUp() 73 protected function setUp(): void
74 { 74 {
75 $this->conf = new ConfigManager('tests/utils/config/configJson'); 75 $this->conf = new ConfigManager('tests/utils/config/configJson');
76 $this->conf->set('resource.datastore', self::$testDatastore); 76 $this->conf->set('resource.datastore', self::$testDatastore);
@@ -107,7 +107,7 @@ class PostLinkTest extends TestCase
107 /** 107 /**
108 * After every test, remove the test datastore. 108 * After every test, remove the test datastore.
109 */ 109 */
110 public function tearDown() 110 protected function tearDown(): void
111 { 111 {
112 @unlink(self::$testDatastore); 112 @unlink(self::$testDatastore);
113 @unlink(self::$testHistory); 113 @unlink(self::$testHistory);
@@ -160,6 +160,8 @@ class PostLinkTest extends TestCase
160 'description' => 'shaare description', 160 'description' => 'shaare description',
161 'tags' => ['one', 'two'], 161 'tags' => ['one', 'two'],
162 'private' => true, 162 'private' => true,
163 'created' => '2015-05-05T12:30:00+03:00',
164 'updated' => '2016-06-05T14:32:10+03:00',
163 ]; 165 ];
164 $env = Environment::mock([ 166 $env = Environment::mock([
165 'REQUEST_METHOD' => 'POST', 167 'REQUEST_METHOD' => 'POST',
@@ -181,10 +183,8 @@ class PostLinkTest extends TestCase
181 $this->assertEquals($link['description'], $data['description']); 183 $this->assertEquals($link['description'], $data['description']);
182 $this->assertEquals($link['tags'], $data['tags']); 184 $this->assertEquals($link['tags'], $data['tags']);
183 $this->assertEquals(true, $data['private']); 185 $this->assertEquals(true, $data['private']);
184 $this->assertTrue( 186 $this->assertSame($link['created'], $data['created']);
185 new \DateTime('2 seconds ago') < \DateTime::createFromFormat(\DateTime::ATOM, $data['created']) 187 $this->assertSame($link['updated'], $data['updated']);
186 );
187 $this->assertEquals('', $data['updated']);
188 } 188 }
189 189
190 /** 190 /**