Mercurial > hg > isophonics-drupal-site
comparison vendor/psy/psysh/test/Readline/TransientTest.php @ 13:5fb285c0d0e3
Update Drupal core to 8.4.7 via Composer. Security update; I *think* we've
been lucky to get away with this so far, as we don't support self-registration
which seems to be used by the so-called "drupalgeddon 2" attack that 8.4.5
was vulnerable to.
author | Chris Cannam |
---|---|
date | Mon, 23 Apr 2018 09:33:26 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
12:7a779792577d | 13:5fb285c0d0e3 |
---|---|
1 <?php | |
2 | |
3 /* | |
4 * This file is part of Psy Shell. | |
5 * | |
6 * (c) 2012-2018 Justin Hileman | |
7 * | |
8 * For the full copyright and license information, please view the LICENSE | |
9 * file that was distributed with this source code. | |
10 */ | |
11 | |
12 namespace Psy\Test\Readline; | |
13 | |
14 use Psy\Readline\Transient; | |
15 | |
16 class TransientTest extends \PHPUnit\Framework\TestCase | |
17 { | |
18 public function testHistory() | |
19 { | |
20 $readline = new Transient(); | |
21 $this->assertEmpty($readline->listHistory()); | |
22 $readline->addHistory('foo'); | |
23 $this->assertSame(['foo'], $readline->listHistory()); | |
24 $readline->addHistory('bar'); | |
25 $this->assertSame(['foo', 'bar'], $readline->listHistory()); | |
26 $readline->addHistory('baz'); | |
27 $this->assertSame(['foo', 'bar', 'baz'], $readline->listHistory()); | |
28 $readline->clearHistory(); | |
29 $this->assertEmpty($readline->listHistory()); | |
30 } | |
31 | |
32 /** | |
33 * @depends testHistory | |
34 */ | |
35 public function testHistorySize() | |
36 { | |
37 $readline = new Transient(null, 2); | |
38 $this->assertEmpty($readline->listHistory()); | |
39 $readline->addHistory('foo'); | |
40 $readline->addHistory('bar'); | |
41 $this->assertSame(['foo', 'bar'], $readline->listHistory()); | |
42 $readline->addHistory('baz'); | |
43 $this->assertSame(['bar', 'baz'], $readline->listHistory()); | |
44 $readline->addHistory('w00t'); | |
45 $this->assertSame(['baz', 'w00t'], $readline->listHistory()); | |
46 $readline->clearHistory(); | |
47 $this->assertEmpty($readline->listHistory()); | |
48 } | |
49 | |
50 /** | |
51 * @depends testHistory | |
52 */ | |
53 public function testHistoryEraseDups() | |
54 { | |
55 $readline = new Transient(null, 0, true); | |
56 $this->assertEmpty($readline->listHistory()); | |
57 $readline->addHistory('foo'); | |
58 $readline->addHistory('bar'); | |
59 $readline->addHistory('foo'); | |
60 $this->assertSame(['bar', 'foo'], $readline->listHistory()); | |
61 $readline->addHistory('baz'); | |
62 $readline->addHistory('w00t'); | |
63 $readline->addHistory('baz'); | |
64 $this->assertSame(['bar', 'foo', 'w00t', 'baz'], $readline->listHistory()); | |
65 $readline->clearHistory(); | |
66 $this->assertEmpty($readline->listHistory()); | |
67 } | |
68 | |
69 public function testSomeThingsAreAlwaysTrue() | |
70 { | |
71 $readline = new Transient(); | |
72 $this->assertTrue(Transient::isSupported()); | |
73 $this->assertTrue($readline->readHistory()); | |
74 $this->assertTrue($readline->writeHistory()); | |
75 } | |
76 } |