Commit 209be17b authored by Dainis Abols's avatar Dainis Abols
Browse files

Added SearchTest and new settings

v4.0.3
parent a5aff0c1
<?php
declare(strict_types=1);
namespace Lu\LuContacts\Tests\Functional;
use Lu\LuApi\Helpers\DataHelper;
use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
/**
* Search test
*
* @author Dainis Abols <dainis.abols@lu.lv>
* @owner University of Latvia
* @since 02.03.2022
*/
class SearchTest extends UnitTestCase
{
protected $resetSingletonInstances = true;
/**
* LocalConfiguration file name and relative location
*
* @var string
*/
private string $LocalConfiguration = 'public/typo3conf/LocalConfiguration.php';
/**
* @test
*/
public function testSearch()
{
// Read settings
$conf = @include $this->LocalConfiguration;
$testUrl = @$conf['EXTENSIONS']['lu_contacts']['testAPIUrl'];
// Read url
$url = $testUrl.'?tx_lucontacts_pi1[action]=list&tx_lucontacts_pi1[listType]=search';
$result = (new DataHelper())->fetchUrl($url);
// Assert url read
$code = !empty($result) ? $result->getStatusCode() : 500;
$this->assertEquals(200, $code, 'Search site not loaded ['.$url.']');
// Read search url
$url = $testUrl.'?tx_lucontacts_pi1[action]=list&tx_lucontacts_pi1[listType]=search&tx_lucontacts_pi1[keyword]=jānis';
$result = (new DataHelper())->fetchUrl($url);
// Assert search return for surnames
$content = @$result->getBody()->getContents();
$this->assertTrue(strpos($content, 'lucontact_personlist_tr') !== false, 'Search list has no data');
}
}
\ No newline at end of file
{
"name": "luitd/lu-contacts",
"version": "4.0.2",
"version": "4.0.3",
"description": "University of Latvia contact list",
"type": "typo3-cms-extension",
"keywords": [
......
# Settings
###########################
# cat=Testing/set; type=string; label=Public API site
testAPIUrl = https://www.lu.lv/contacts/
......@@ -9,7 +9,7 @@ $EM_CONF[$_EXTKEY] = [
'author_email' => 'dainis.abols@lu.lv',
'state' => 'stable',
'clearCacheOnLoad' => true,
'version' => '4.0.2',
'version' => '4.0.3',
'dependencies' => 'typo3,lu_api',
'constraints' => [
'depends' => [
......
......@@ -4,7 +4,7 @@ Extension to render list of contacts for University of Latvia
## Version
4.0.2
4.0.3
## Dependencies
......@@ -48,3 +48,4 @@ LU API v3+
| Functional/ListSurnameTest.php | 4 |
| Functional/ListAddressTest.php | 4 |
| Functional/ListUnitTest.php | 5 |
| Functional/SearchTest.php | 4 |
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment