Mercurial > hg > cmmr2012-drupal-site
comparison core/modules/dblog/tests/src/Functional/DbLogResourceTest.php @ 5:12f9dff5fda9 tip
Update to Drupal core 8.7.1
author | Chris Cannam |
---|---|
date | Thu, 09 May 2019 15:34:47 +0100 |
parents | a9cd425dd02b |
children |
comparison
equal
deleted
inserted
replaced
4:a9cd425dd02b | 5:12f9dff5fda9 |
---|---|
1 <?php | 1 <?php |
2 | 2 |
3 namespace Drupal\Tests\dblog\Functional; | 3 namespace Drupal\Tests\dblog\Functional; |
4 | 4 |
5 use Drupal\Component\Serialization\Json; | 5 use Drupal\Component\Serialization\Json; |
6 use Drupal\Core\Database\Database; | |
6 use Drupal\Core\Url; | 7 use Drupal\Core\Url; |
7 use Drupal\Tests\rest\Functional\CookieResourceTestTrait; | 8 use Drupal\Tests\rest\Functional\CookieResourceTestTrait; |
8 use Drupal\Tests\rest\Functional\ResourceTestBase; | 9 use Drupal\Tests\rest\Functional\ResourceTestBase; |
9 | 10 |
10 /** | 11 /** |
56 */ | 57 */ |
57 public function testWatchdog() { | 58 public function testWatchdog() { |
58 // Write a log message to the DB. | 59 // Write a log message to the DB. |
59 $this->container->get('logger.channel.rest')->notice('Test message'); | 60 $this->container->get('logger.channel.rest')->notice('Test message'); |
60 // Get the ID of the written message. | 61 // Get the ID of the written message. |
61 $id = db_query_range("SELECT wid FROM {watchdog} WHERE type = :type ORDER BY wid DESC", 0, 1, [':type' => 'rest']) | 62 $id = Database::getConnection()->queryRange("SELECT wid FROM {watchdog} WHERE type = :type ORDER BY wid DESC", 0, 1, [':type' => 'rest']) |
62 ->fetchField(); | 63 ->fetchField(); |
63 | 64 |
64 $this->initAuthentication(); | 65 $this->initAuthentication(); |
65 $url = Url::fromRoute('rest.dblog.GET', ['id' => $id, '_format' => static::$format]); | 66 $url = Url::fromRoute('rest.dblog.GET', ['id' => $id, '_format' => static::$format]); |
66 $request_options = $this->getAuthenticationRequestOptions('GET'); | 67 $request_options = $this->getAuthenticationRequestOptions('GET'); |