Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"mikey179/vfsstream": "^1.6.12",
"nexusphp/tachycardia": "^2.0",
"phpstan/extension-installer": "^1.4",
"phpstan/phpstan": "^2.2.1",
"phpstan/phpstan": "^2.2.15",
"phpstan/phpstan-strict-rules": "^2.0",
"phpunit/phpcov": "^9.0.2 || ^10.0",
"phpunit/phpunit": "^10.5.16 || ^11.2",
Expand Down
3 changes: 2 additions & 1 deletion tests/system/Config/ServicesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,8 @@ public function testNewUnsharedLanguage(): void
{
$actual = Services::language(null, false);
$this->assertInstanceOf(Language::class, $actual);
$this->assertSame('en', $actual->getLocale());
$locale = $actual->getLocale();
$this->assertSame('en', $locale);

Services::language('la', false);
$this->assertSame('en', $actual->getLocale());
Expand Down
3 changes: 2 additions & 1 deletion tests/system/Email/EmailTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,8 @@ public function testSetPriorityFallback(): void

// Priority 6 is invalid, falls back to 3
$email->setPriority(6);
$this->assertSame(3, $this->getPrivateProperty($email, 'priority'));
$priority = $this->getPrivateProperty($email, 'priority');
$this->assertSame(3, $priority);

// Priority 0 is invalid, falls back to 3
$email->setPriority(0);
Expand Down
3 changes: 2 additions & 1 deletion tests/system/Encryption/Handlers/OpenSSLHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,8 @@ public function testInternalKeyNotModifiedByParams(): void
$encrypter = $this->encryption->initialize($params);
$this->assertInstanceOf(OpenSSLHandler::class, $encrypter);

$this->assertSame('original-key-value', $encrypter->key);
$key = $encrypter->key;
$this->assertSame('original-key-value', $key);

$message = 'This is a plain-text message.';
$differentKey = 'temporary-param-key';
Expand Down
3 changes: 2 additions & 1 deletion tests/system/Encryption/Handlers/SodiumHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,8 @@ public function testInternalKeyNotModifiedByParams(): void
$encrypter = $this->encryption->initialize($this->config);
$this->assertInstanceOf(SodiumHandler::class, $encrypter);

$this->assertSame($originalKey, $encrypter->key);
$key = $encrypter->key;
$this->assertSame($originalKey, $key);

$message = 'This is a plain-text message.';
$differentKey = sodium_crypto_secretbox_keygen();
Expand Down
5 changes: 3 additions & 2 deletions tests/system/Entity/EntityTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -373,8 +373,9 @@ public function testCastInteger(): void

$entity->first = 3.1;

$this->assertIsInt($entity->first);
$this->assertSame(3, $entity->first);
$first = $entity->first;
$this->assertIsInt($first);
$this->assertSame(3, $first);

$entity->first = 3.6;

Expand Down
3 changes: 2 additions & 1 deletion tests/system/Events/EventsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ public function testInitialize(): void

// but we should be able to change it through the backdoor
MockEvents::setFiles(['/peanuts']);
$this->assertSame(['/peanuts'], Events::getFiles());
$files = Events::getFiles();
$this->assertSame(['/peanuts'], $files);

// re-initializing should have no effect
MockEvents::initialize();
Expand Down
3 changes: 2 additions & 1 deletion tests/system/HTTP/IncomingRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1057,7 +1057,8 @@ public function testGetIPAddressNormal(): void
$request = new Request(new App());
$request->populateHeaders();

$this->assertSame($expected, $request->getIPAddress());
$ipAddress = $request->getIPAddress();
$this->assertSame($expected, $ipAddress);
// call a second time to exercise the initial conditional block in getIPAddress()
$this->assertSame($expected, $request->getIPAddress());
}
Expand Down
3 changes: 2 additions & 1 deletion tests/system/HTTP/RequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,8 @@ public function testGetIPAddressNormal(): void
$expected = '123.123.123.123';
service('superglobals')->setServer('REMOTE_ADDR', $expected);
$this->request = new Request(new App());
$this->assertSame($expected, $this->request->getIPAddress());
$ipAddress = $this->request->getIPAddress();
$this->assertSame($expected, $ipAddress);
// call a second time to exercise the initial conditional block in getIPAddress()
$this->assertSame($expected, $this->request->getIPAddress());
}
Expand Down
9 changes: 6 additions & 3 deletions tests/system/Helpers/FormHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -870,7 +870,8 @@ public function testSetValue(): void
public function testSetSelect(): void
{
$_SESSION['_ci_old_input']['post']['foo'] = 'bar';
$this->assertSame(' selected="selected"', set_select('foo', 'bar'));
$selected = set_select('foo', 'bar');
$this->assertSame(' selected="selected"', $selected);

$_SESSION['_ci_old_input']['post']['foo'] = ['foo' => 'bar'];
$this->assertSame(' selected="selected"', set_select('foo', 'bar'));
Expand All @@ -890,7 +891,8 @@ public function testSetCheckbox(): void
],
];

$this->assertSame(' checked="checked"', set_checkbox('foo', 'bar'));
$checked = set_checkbox('foo', 'bar');
$this->assertSame(' checked="checked"', $checked);

$_SESSION = [
'_ci_old_input' => [
Expand Down Expand Up @@ -919,7 +921,8 @@ public function testSetCheckboxWithValueZero(): void
],
];

$this->assertSame(' checked="checked"', set_checkbox('foo', '0'));
$checked = set_checkbox('foo', '0');
$this->assertSame(' checked="checked"', $checked);

$_SESSION = [
'_ci_old_input' => [
Expand Down
3 changes: 2 additions & 1 deletion tests/system/Helpers/TextHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,8 @@ public function testIncrementString(): void
$this->assertSame('my-test_1', increment_string('my-test'));
$this->assertSame('my-test-1', increment_string('my-test', '-'));
$this->assertSame('file_5', increment_string('file_4'));
$this->assertSame('file-5', increment_string('file-4', '-'));
$incremented = increment_string('file-4', '-');
$this->assertSame('file-5', $incremented);
$this->assertSame('file-5', increment_string('file-4', '-'));
$this->assertSame('file-1', increment_string('file', '-', 1));
$this->assertSame('124', increment_string('123', ''));
Expand Down
6 changes: 4 additions & 2 deletions tests/system/Language/LanguageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -338,10 +338,12 @@ public function testLangKeepLocale(): void
$lang = service('language', 'en', true);

lang('Language.languageGetLineInvalidArgumentException');
$this->assertSame('en', $lang->getLocale());
$locale = $lang->getLocale();
$this->assertSame('en', $locale);

lang('Language.languageGetLineInvalidArgumentException', [], 'ru');
$this->assertSame('en', $lang->getLocale());
$locale = $lang->getLocale();
$this->assertSame('en', $locale);

lang('Language.languageGetLineInvalidArgumentException');
$this->assertSame('en', $lang->getLocale());
Expand Down
3 changes: 2 additions & 1 deletion tests/system/Session/Handlers/Database/RedisHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,8 @@ public function testSecondaryReadAfterClose(): void
$expected = <<<'DATA'
__ci_last_regenerate|i:1664607454;_ci_previous_url|s:32:"http://localhost:8080/index.php/";key|s:5:"value";
DATA;
$this->assertSame($expected, $handler->read('555556b43phsnnf8if6bo33b635e4447'));
$data = $handler->read('555556b43phsnnf8if6bo33b635e4447');
$this->assertSame($expected, $data);

$handler->close();

Expand Down
3 changes: 2 additions & 1 deletion tests/system/Throttle/ThrottleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ public function testTokenTime(): void
$throttler = new Throttler($this->cache);

// tokenTime should be 0 to start
$this->assertSame(0, $throttler->getTokenTime());
$tokenTime = $throttler->getTokenTime();
$this->assertSame(0, $tokenTime);

// set $rate
$rate = 1; // allow 1 request per minute
Expand Down
3 changes: 2 additions & 1 deletion tests/system/View/ParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -962,7 +962,8 @@ public function testCachedRender(): void
$this->parser->setVar('teststring', 'Hello World');

$expected = "<h1>Hello World</h1>\n";
$this->assertSame($expected, $this->parser->render('template1', ['cache' => 10, 'cache_name' => 'HelloWorld']));
$output = $this->parser->render('template1', ['cache' => 10, 'cache_name' => 'HelloWorld']);
$this->assertSame($expected, $output);
// this second renderings should go thru the cache
$this->assertSame($expected, $this->parser->render('template1', ['cache' => 10, 'cache_name' => 'HelloWorld']));
}
Expand Down
Loading