Parcourir la source

Add search default raw value

Before, the default value was undefined. Now it always has a value even when no value is provided.
Alexis Degrugillier il y a 11 ans
Parent
commit
50b6a02578
2 fichiers modifiés avec 2 ajouts et 2 suppressions
  1. 1 1
      app/Models/Search.php
  2. 1 1
      tests/app/Models/SearchTest.php

+ 1 - 1
app/Models/Search.php

@@ -11,7 +11,7 @@ require_once(LIB_PATH . '/lib_date.php');
 class FreshRSS_Search {
 
 	// This contains the user input string
-	private $raw_input;
+	private $raw_input = '';
 	// The following properties are extracted from the raw input
 	private $intitle;
 	private $min_date;

+ 1 - 1
tests/app/Models/SearchTest.php

@@ -10,7 +10,7 @@ class SearchTest extends \PHPUnit_Framework_TestCase {
 	 */
 	public function test__construct_whenInputIsEmpty_getsOnlyNullValues($input) {
 		$search = new FreshRSS_Search($input);
-		$this->assertNull($search->getRawInput());
+		$this->assertEquals('', $search->getRawInput());
 		$this->assertNull($search->getIntitle());
 		$this->assertNull($search->getMinDate());
 		$this->assertNull($search->getMaxDate());