- * require_once 'Calendar'.DIRECTORY_SEPARATOR.'Day.php';
- * $Day = & new Calendar_Day(2003, 10, 21); // Oct 21st 2003
- * while ($Hour = & $Day->fetch()) {
- * echo $Hour->thisHour().'
';
- * }
- *
- */
-class Calendar_Day extends Calendar
-{
- /**
- * Marks the Day at the beginning of a week
- *
- * @var bool
- */
- public $first = false;
-
- /**
- * Marks the Day at the end of a week
- *
- * @var bool
- */
- public $last = false;
-
- /**
- * Used for tabular calendars
- *
- * @var bool
- */
- public $empty = false;
-
- /**
- * Constructs Calendar_Day
- *
- * @param int year e.g. 2003
- * @param int month e.g. 8
- * @param int day e.g. 15
- */
- public function __construct($y, $m, $d)
- {
- parent::__construct($y, $m, $d);
- }
-
- /**
- * Builds the Hours of the Day
- *
- * @param array (optional) Caledar_Hour objects representing selected dates
- *
- * @return bool
- */
- public function build($sDates = [])
- {
- require_once CALENDAR_ROOT.'Hour.php';
-
- $hID = $this->cE->getHoursInDay($this->year, $this->month, $this->day);
- for ($i = 0; $i < $hID; $i++) {
- $this->children[$i] =
- new Calendar_Hour($this->year, $this->month, $this->day, $i);
- }
- if (count($sDates) > 0) {
- $this->setSelection($sDates);
- }
-
- return true;
- }
-
- /**
- * Called from build()
- *
- * @param array
- *
- * @return void
- */
- public function setSelection($sDates)
- {
- foreach ($sDates as $sDate) {
- if ($this->year == $sDate->thisYear()
- && $this->month == $sDate->thisMonth()
- && $this->day == $sDate->thisDay()) {
- $key = (int) $sDate->thisHour();
- if (isset($this->children[$key])) {
- $sDate->setSelected();
- $this->children[$key] = $sDate;
- }
- }
- }
- }
-
- /**
- * Defines Day object as first in a week
- * Only used by Calendar_Month_Weekdays::build()
- *
- * @param bool state
- *
- * @return void
- */
- public function setFirst($state = true)
- {
- $this->first = $state;
- }
-
- /**
- * Defines Day object as last in a week
- * Used only following Calendar_Month_Weekdays::build()
- *
- * @param bool state
- *
- * @return void
- */
- public function setLast($state = true)
- {
- $this->last = $state;
- }
-
- /**
- * Returns true if Day object is first in a Week
- * Only relevant when Day is created by Calendar_Month_Weekdays::build()
- *
- * @return bool
- */
- public function isFirst()
- {
- return $this->first;
- }
-
- /**
- * Returns true if Day object is last in a Week
- * Only relevant when Day is created by Calendar_Month_Weekdays::build()
- *
- * @return bool
- */
- public function isLast()
- {
- return $this->last;
- }
-
- /**
- * Defines Day object as empty
- * Only used by Calendar_Month_Weekdays::build()
- *
- * @param bool state
- *
- * @return void
- */
- public function setEmpty($state = true)
- {
- $this->empty = $state;
- }
-
- /**
- * @return bool
- */
- public function isEmpty()
- {
- return $this->empty;
- }
-}
diff --git a/data/module/Calendar/Decorator.php b/data/module/Calendar/Decorator.php
deleted file mode 100644
index a826e85c43..0000000000
--- a/data/module/Calendar/Decorator.php
+++ /dev/null
@@ -1,598 +0,0 @@
- |
-// +----------------------------------------------------------------------+
-//
-// $Id: Decorator.php,v 1.3 2005/10/22 10:29:46 quipo Exp $
-//
-/**
- * @version $Id$
- */
-/**
- * Decorates any calendar class.
- * Create a subclass of this class for your own "decoration".
- * Used for "selections"
- *
- * class DayDecorator extends Calendar_Decorator
- * {
- * function thisDay($format = 'int')
- * {
-.* $day = parent::thisDay('timestamp');
-.* return date('D', $day);
- * }
- * }
- * $Day = & new Calendar_Day(2003, 10, 25);
- * $DayDecorator = & new DayDecorator($Day);
- * echo $DayDecorator->thisDay(); // Outputs "Sat"
- *
- *
- * @abstract
- */
-class Calendar_Decorator
-{
- /**
- * Subclass of Calendar being decorated
- *
- * @var object
- */
- public $calendar;
-
- /**
- * Constructs the Calendar_Decorator
- *
- * @param object subclass to Calendar to decorate
- */
- public function __construct(&$calendar)
- {
- $this->calendar = &$calendar;
- }
-
- /**
- * Defines the calendar by a Unix timestamp, replacing values
- * passed to the constructor
- *
- * @param int Unix timestamp
- *
- * @return void
- */
- public function setTimestamp($ts)
- {
- $this->calendar->setTimestamp($ts);
- }
-
- /**
- * Returns a timestamp from the current date / time values. Format of
- * timestamp depends on Calendar_Engine implementation being used
- *
- * @return int timestamp
- */
- public function getTimestamp()
- {
- return $this->calendar->getTimeStamp();
- }
-
- /**
- * Defines calendar object as selected (e.g. for today)
- *
- * @param bool state whether Calendar subclass
- *
- * @return void
- */
- public function setSelected($state = true)
- {
- $this->calendar->setSelected($state = true);
- }
-
- /**
- * True if the calendar subclass object is selected (e.g. today)
- *
- * @return bool
- */
- public function isSelected()
- {
- return $this->calendar->isSelected();
- }
-
- /**
- * Adjusts the date (helper method)
- *
- * @return void
- */
- public function adjust()
- {
- $this->calendar->adjust();
- }
-
- /**
- * Returns the date as an associative array (helper method)
- *
- * @param mixed timestamp (leave empty for current timestamp)
- *
- * @return array
- */
- public function toArray($stamp = null)
- {
- return $this->calendar->toArray($stamp);
- }
-
- /**
- * Returns the value as an associative array (helper method)
- *
- * @param string type of date object that return value represents
- * @param string $format ['int' | 'array' | 'timestamp' | 'object']
- * @param mixed timestamp (depending on Calendar engine being used)
- * @param int integer default value (i.e. give me the answer quick)
- *
- * @return mixed
- */
- public function returnValue($returnType, $format, $stamp, $default)
- {
- return $this->calendar->returnValue($returnType, $format, $stamp, $default);
- }
-
- /**
- * Defines Day object as first in a week
- * Only used by Calendar_Month_Weekdays::build()
- *
- * @param bool state
- *
- * @return void
- */
- public function setFirst($state = true)
- {
- if (method_exists($this->calendar, 'setFirst')) {
- $this->calendar->setFirst($state);
- }
- }
-
- /**
- * Defines Day object as last in a week
- * Used only following Calendar_Month_Weekdays::build()
- *
- * @param bool state
- *
- * @return void
- */
- public function setLast($state = true)
- {
- if (method_exists($this->calendar, 'setLast')) {
- $this->calendar->setLast($state);
- }
- }
-
- /**
- * Returns true if Day object is first in a Week
- * Only relevant when Day is created by Calendar_Month_Weekdays::build()
- *
- * @return bool
- */
- public function isFirst()
- {
- if (method_exists($this->calendar, 'isFirst')) {
- return $this->calendar->isFirst();
- }
-
- return false;
- }
-
- /**
- * Returns true if Day object is last in a Week
- * Only relevant when Day is created by Calendar_Month_Weekdays::build()
- *
- * @return bool
- */
- public function isLast()
- {
- if (method_exists($this->calendar, 'isLast')) {
- return $this->calendar->isLast();
- }
-
- return false;
- }
-
- /**
- * Defines Day object as empty
- * Only used by Calendar_Month_Weekdays::build()
- *
- * @param bool state
- *
- * @return void
- */
- public function setEmpty($state = true)
- {
- if (method_exists($this->calendar, 'setEmpty')) {
- $this->calendar->setEmpty($state);
- }
- }
-
- /**
- * @return bool
- */
- public function isEmpty()
- {
- if (method_exists($this->calendar, 'isEmpty')) {
- return $this->calendar->isEmpty();
- }
-
- return false;
- }
-
- /**
- * Build the children
- *
- * @param array containing Calendar objects to select (optional)
- *
- * @return bool
- * @abstract
- */
- public function build($sDates = [])
- {
- return $this->calendar->build($sDates);
- }
-
- /**
- * Iterator method for fetching child Calendar subclass objects
- * (e.g. a minute from an hour object). On reaching the end of
- * the collection, returns false and resets the collection for
- * further iteratations.
- *
- * @return mixed either an object subclass of Calendar or false
- */
- public function fetch($decorator = null)
- {
- return $this->calendar->fetch();
- }
-
- /**
- * Fetches all child from the current collection of children
- *
- * @return array
- */
- public function fetchAll($decorator = null)
- {
- return $this->calendar->fetchAll();
- }
-
- /**
- * Get the number Calendar subclass objects stored in the internal
- * collection.
- *
- * @return int
- */
- public function size()
- {
- return $this->calendar->size();
- }
-
- /**
- * Determine whether this date is valid, with the bounds determined by
- * the Calendar_Engine. The call is passed on to
- * Calendar_Validator::isValid
- *
- * @return bool
- */
- public function isValid()
- {
- return $this->calendar->isValid();
- }
-
- /**
- * Returns an instance of Calendar_Validator
- *
- * @return Calendar_Validator
- */
- public function &getValidator()
- {
- $validator = $this->calendar->getValidator();
-
- return $validator;
- }
-
- /**
- * Returns a reference to the current Calendar_Engine being used. Useful
- * for Calendar_Table_Helper and Calendar_Validator
- *
- * @return object implementing Calendar_Engine_Inteface
- */
- public function &getEngine()
- {
- return $this->calendar->getEngine();
- }
-
- /**
- * Returns the value for the previous year
- *
- * @param string return value format ['int' | 'timestamp' | 'object' | 'array']
- *
- * @return int e.g. 2002 or timestamp
- */
- public function prevYear($format = 'int')
- {
- return $this->calendar->prevYear($format);
- }
-
- /**
- * Returns the value for this year
- *
- * @param string return value format ['int' | 'timestamp' | 'object' | 'array']
- *
- * @return int e.g. 2003 or timestamp
- */
- public function thisYear($format = 'int')
- {
- return $this->calendar->thisYear($format);
- }
-
- /**
- * Returns the value for next year
- *
- * @param string return value format ['int' | 'timestamp' | 'object' | 'array']
- *
- * @return int e.g. 2004 or timestamp
- */
- public function nextYear($format = 'int')
- {
- return $this->calendar->nextYear($format);
- }
-
- /**
- * Returns the value for the previous month
- *
- * @param string return value format ['int' | 'timestamp' | 'object' | 'array']
- *
- * @return int e.g. 4 or Unix timestamp
- */
- public function prevMonth($format = 'int')
- {
- return $this->calendar->prevMonth($format);
- }
-
- /**
- * Returns the value for this month
- *
- * @param string return value format ['int' | 'timestamp' | 'object' | 'array']
- *
- * @return int e.g. 5 or timestamp
- */
- public function thisMonth($format = 'int')
- {
- return $this->calendar->thisMonth($format);
- }
-
- /**
- * Returns the value for next month
- *
- * @param string return value format ['int' | 'timestamp' | 'object' | 'array']
- *
- * @return int e.g. 6 or timestamp
- */
- public function nextMonth($format = 'int')
- {
- return $this->calendar->nextMonth($format);
- }
-
- /**
- * Returns the value for the previous week
- *
- * @param string return value format ['int' | 'timestamp' | 'object' | 'array']
- *
- * @return int e.g. 4 or Unix timestamp
- */
- public function prevWeek($format = 'n_in_month')
- {
- if (method_exists($this->calendar, 'prevWeek')) {
- return $this->calendar->prevWeek($format);
- } else {
- require_once 'PEAR.php';
- PEAR::raiseError(
- 'Cannot call prevWeek on Calendar object of type: '.
- get_class($this->calendar), 133, PEAR_ERROR_TRIGGER,
- E_USER_NOTICE, 'Calendar_Decorator::prevWeek()');
-
- return false;
- }
- }
-
- /**
- * Returns the value for this week
- *
- * @param string return value format ['int' | 'timestamp' | 'object' | 'array']
- *
- * @return int e.g. 5 or timestamp
- */
- public function thisWeek($format = 'n_in_month')
- {
- if (method_exists($this->calendar, 'thisWeek')) {
- return $this->calendar->thisWeek($format);
- } else {
- require_once 'PEAR.php';
- PEAR::raiseError(
- 'Cannot call thisWeek on Calendar object of type: '.
- get_class($this->calendar), 133, PEAR_ERROR_TRIGGER,
- E_USER_NOTICE, 'Calendar_Decorator::thisWeek()');
-
- return false;
- }
- }
-
- /**
- * Returns the value for next week
- *
- * @param string return value format ['int' | 'timestamp' | 'object' | 'array']
- *
- * @return int e.g. 6 or timestamp
- */
- public function nextWeek($format = 'n_in_month')
- {
- if (method_exists($this->calendar, 'nextWeek')) {
- return $this->calendar->nextWeek($format);
- } else {
- require_once 'PEAR.php';
- PEAR::raiseError(
- 'Cannot call thisWeek on Calendar object of type: '.
- get_class($this->calendar), 133, PEAR_ERROR_TRIGGER,
- E_USER_NOTICE, 'Calendar_Decorator::nextWeek()');
-
- return false;
- }
- }
-
- /**
- * Returns the value for the previous day
- *
- * @param string return value format ['int' | 'timestamp' | 'object' | 'array']
- *
- * @return int e.g. 10 or timestamp
- */
- public function prevDay($format = 'int')
- {
- return $this->calendar->prevDay($format);
- }
-
- /**
- * Returns the value for this day
- *
- * @param string return value format ['int' | 'timestamp' | 'object' | 'array']
- *
- * @return int e.g. 11 or timestamp
- */
- public function thisDay($format = 'int')
- {
- return $this->calendar->thisDay($format);
- }
-
- /**
- * Returns the value for the next day
- *
- * @param string return value format ['int' | 'timestamp' | 'object' | 'array']
- *
- * @return int e.g. 12 or timestamp
- */
- public function nextDay($format = 'int')
- {
- return $this->calendar->nextDay($format);
- }
-
- /**
- * Returns the value for the previous hour
- *
- * @param string return value format ['int' | 'timestamp' | 'object' | 'array']
- *
- * @return int e.g. 13 or timestamp
- */
- public function prevHour($format = 'int')
- {
- return $this->calendar->prevHour($format);
- }
-
- /**
- * Returns the value for this hour
- *
- * @param string return value format ['int' | 'timestamp' | 'object' | 'array']
- *
- * @return int e.g. 14 or timestamp
- */
- public function thisHour($format = 'int')
- {
- return $this->calendar->thisHour($format);
- }
-
- /**
- * Returns the value for the next hour
- *
- * @param string return value format ['int' | 'timestamp' | 'object' | 'array']
- *
- * @return int e.g. 14 or timestamp
- */
- public function nextHour($format = 'int')
- {
- return $this->calendar->nextHour($format);
- }
-
- /**
- * Returns the value for the previous minute
- *
- * @param string return value format ['int' | 'timestamp' | 'object' | 'array']
- *
- * @return int e.g. 23 or timestamp
- */
- public function prevMinute($format = 'int')
- {
- return $this->calendar->prevMinute($format);
- }
-
- /**
- * Returns the value for this minute
- *
- * @param string return value format ['int' | 'timestamp' | 'object' | 'array']
- *
- * @return int e.g. 24 or timestamp
- */
- public function thisMinute($format = 'int')
- {
- return $this->calendar->thisMinute($format);
- }
-
- /**
- * Returns the value for the next minute
- *
- * @param string return value format ['int' | 'timestamp' | 'object' | 'array']
- *
- * @return int e.g. 25 or timestamp
- */
- public function nextMinute($format = 'int')
- {
- return $this->calendar->nextMinute($format);
- }
-
- /**
- * Returns the value for the previous second
- *
- * @param string return value format ['int' | 'timestamp' | 'object' | 'array']
- *
- * @return int e.g. 43 or timestamp
- */
- public function prevSecond($format = 'int')
- {
- return $this->calendar->prevSecond($format);
- }
-
- /**
- * Returns the value for this second
- *
- * @param string return value format ['int' | 'timestamp' | 'object' | 'array']
- *
- * @return int e.g. 44 or timestamp
- */
- public function thisSecond($format = 'int')
- {
- return $this->calendar->thisSecond($format);
- }
-
- /**
- * Returns the value for the next second
- *
- * @param string return value format ['int' | 'timestamp' | 'object' | 'array']
- *
- * @return int e.g. 45 or timestamp
- */
- public function nextSecond($format = 'int')
- {
- return $this->calendar->nextSecond($format);
- }
-}
diff --git a/data/module/Calendar/Decorator/Textual.php b/data/module/Calendar/Decorator/Textual.php
deleted file mode 100644
index 1fffc79b0d..0000000000
--- a/data/module/Calendar/Decorator/Textual.php
+++ /dev/null
@@ -1,176 +0,0 @@
- |
-// | Lorenzo Alberton
- * $Day = new Calendar_Day(2003, 10, 23);
- * $Uri = & new Calendar_Decorator_Uri($Day);
- * $Uri->setFragments('year', 'month', 'day');
- * echo $Uri->getPrev(); // Displays year=2003&month=10&day=22
- *
- *
- * @see Calendar_Util_Uri
- */
-class Calendar_Decorator_Uri extends Calendar_Decorator
-{
- /**
- * @var Calendar_Util_Uri
- */
- public $Uri;
-
- /**
- * Constructs Calendar_Decorator_Uri
- *
- * @param object subclass of Calendar
- */
- public function __construct(&$Calendar)
- {
- parent::__construct($Calendar);
- }
-
- /**
- * Sets the URI fragment names
- *
- * @param string URI fragment for year
- * @param string (optional) URI fragment for month
- * @param string (optional) URI fragment for day
- * @param string (optional) URI fragment for hour
- * @param string (optional) URI fragment for minute
- * @param string (optional) URI fragment for second
- *
- * @return void
- */
- public function setFragments($y, $m = null, $d = null, $h = null, $i = null, $s = null)
- {
- $this->Uri = new Calendar_Util_Uri($y, $m, $d, $h, $i, $s);
- }
-
- /**
- * Sets the separator string between fragments
- *
- * @param string separator e.g. /
- *
- * @return void
- */
- public function setSeparator($separator)
- {
- $this->Uri->separator = $separator;
- }
-
- /**
- * Puts Uri decorator into "scalar mode" - URI variable names are not
- * returned
- *
- * @param bool (optional)
- *
- * @return void
- */
- public function setScalar($state = true)
- {
- $this->Uri->scalar = $state;
- }
-
- /**
- * Gets the URI string for the previous calendar unit
- *
- * @param string calendar unit to fetch uri for (year,month,week or day etc)
- *
- * @return string
- */
- public function prev($method)
- {
- return $this->Uri->prev($this, $method);
- }
-
- /**
- * Gets the URI string for the current calendar unit
- *
- * @param string calendar unit to fetch uri for (year,month,week or day etc)
- *
- * @return string
- */
- public function this($method)
- {
- return $this->Uri->this($this, $method);
- }
-
- /**
- * Gets the URI string for the next calendar unit
- *
- * @param string calendar unit to fetch uri for (year,month,week or day etc)
- *
- * @return string
- */
- public function next($method)
- {
- return $this->Uri->next($this, $method);
- }
-}
diff --git a/data/module/Calendar/Decorator/Weekday.php b/data/module/Calendar/Decorator/Weekday.php
deleted file mode 100644
index 9506b5fdbe..0000000000
--- a/data/module/Calendar/Decorator/Weekday.php
+++ /dev/null
@@ -1,156 +0,0 @@
- |
-// | Lorenzo Alberton
- * $Day = new Calendar_Day(2003, 10, 23);
- * $Weekday = & new Calendar_Decorator_Weekday($Day);
- * $Weekday->setFirstDay(0); // Set first day of week to Sunday (default Mon)
- * echo $Weekday->thisWeekDay(); // Displays 5 - fifth day of week relative to Sun
- *
- */
-class Calendar_Decorator_Weekday extends Calendar_Decorator
-{
- /**
- * First day of week
- *
- * @var int (default = 1 for Monday)
- */
- public $firstDay = 1;
-
- /**
- * Constructs Calendar_Decorator_Weekday
- *
- * @param object subclass of Calendar
- */
- public function __construct(&$Calendar)
- {
- parent::__construct($Calendar);
- }
-
- /**
- * Sets the first day of the week (0 = Sunday, 1 = Monday (default) etc)
- *
- * @param int first day of week
- *
- * @return void
- */
- public function setFirstDay($firstDay)
- {
- $this->firstDay = (int) $firstDay;
- }
-
- /**
- * Returns the previous weekday
- *
- * @param string (default = 'int') return value format
- *
- * @return int numeric day of week or timestamp
- */
- public function prevWeekDay($format = 'int')
- {
- $ts = $this->calendar->prevDay('timestamp');
- $Day = new Calendar_Day(2000, 1, 1);
- $Day->setTimeStamp($ts);
- $day = $this->calendar->cE->getDayOfWeek($Day->thisYear(), $Day->thisMonth(), $Day->thisDay());
- $day = $this->adjustWeekScale($day);
-
- return $this->returnValue('Day', $format, $ts, $day);
- }
-
- /**
- * Returns the current weekday
- *
- * @param string (default = 'int') return value format
- *
- * @return int numeric day of week or timestamp
- */
- public function thisWeekDay($format = 'int')
- {
- $ts = $this->calendar->thisDay('timestamp');
- $day = $this->calendar->cE->getDayOfWeek($this->calendar->year, $this->calendar->month, $this->calendar->day);
- $day = $this->adjustWeekScale($day);
-
- return $this->returnValue('Day', $format, $ts, $day);
- }
-
- /**
- * Returns the next weekday
- *
- * @param string (default = 'int') return value format
- *
- * @return int numeric day of week or timestamp
- */
- public function nextWeekDay($format = 'int')
- {
- $ts = $this->calendar->nextDay('timestamp');
- $Day = new Calendar_Day(2000, 1, 1);
- $Day->setTimeStamp($ts);
- $day = $this->calendar->cE->getDayOfWeek($Day->thisYear(), $Day->thisMonth(), $Day->thisDay());
- $day = $this->adjustWeekScale($day);
-
- return $this->returnValue('Day', $format, $ts, $day);
- }
-
- /**
- * Adjusts the day of the week relative to the first day of the week
- *
- * @param int day of week calendar from Calendar_Engine
- *
- * @return int day of week adjusted to first day
- */
- public function adjustWeekScale($dayOfWeek)
- {
- $dayOfWeek = $dayOfWeek - $this->firstDay;
- if ($dayOfWeek >= 0) {
- return $dayOfWeek;
- } else {
- return $this->calendar->cE->getDaysInWeek(
- $this->calendar->year, $this->calendar->month, $this->calendar->day
- ) + $dayOfWeek;
- }
- }
-}
diff --git a/data/module/Calendar/Decorator/Wrapper.php b/data/module/Calendar/Decorator/Wrapper.php
deleted file mode 100644
index ba6c816775..0000000000
--- a/data/module/Calendar/Decorator/Wrapper.php
+++ /dev/null
@@ -1,92 +0,0 @@
- |
-// | Lorenzo Alberton - * array ( - * [0] => year (e.g 2003), - * [1] => month (e.g 9), - * [2] => day (e.g 6), - * [3] => hour (e.g 14), - * [4] => minute (e.g 34), - * [5] => second (e.g 45), - * [6] => num days in month (e.g. 31), - * [7] => week in year (e.g. 50), - * [8] => day in week (e.g. 0 for Sunday) - * ) - *- * Uses a static variable to prevent date() being used twice - * for a date which is already known - * - * @param int Unix timestamp - * - * @return array - */ - public function stampCollection($stamp) - { - static $stamps = []; - if (!isset($stamps[$stamp])) { - $date = @date('Y n j H i s t W w', $stamp); - $stamps[$stamp] = sscanf($date, '%d %d %d %d %d %d %d %d %d'); - } - - return $stamps[$stamp]; - } - - /** - * Returns a numeric year given a timestamp - * - * @param int Unix timestamp - * - * @return int year (e.g. 2003) - */ - public function stampToYear($stamp) - { - $date = self::stampCollection($stamp); - - return (int) $date[0]; - } - - /** - * Returns a numeric month given a timestamp - * - * @param int Unix timestamp - * - * @return int month (e.g. 9) - */ - public function stampToMonth($stamp) - { - $date = self::stampCollection($stamp); - - return (int) $date[1]; - } - - /** - * Returns a numeric day given a timestamp - * - * @param int Unix timestamp - * - * @return int day (e.g. 15) - */ - public function stampToDay($stamp) - { - $date = self::stampCollection($stamp); - - return (int) $date[2]; - } - - /** - * Returns a numeric hour given a timestamp - * - * @param int Unix timestamp - * - * @return int hour (e.g. 13) - */ - public function stampToHour($stamp) - { - $date = self::stampCollection($stamp); - - return (int) $date[3]; - } - - /** - * Returns a numeric minute given a timestamp - * - * @param int Unix timestamp - * - * @return int minute (e.g. 34) - */ - public function stampToMinute($stamp) - { - $date = self::stampCollection($stamp); - - return (int) $date[4]; - } - - /** - * Returns a numeric second given a timestamp - * - * @param int Unix timestamp - * - * @return int second (e.g. 51) - */ - public function stampToSecond($stamp) - { - $date = self::stampCollection($stamp); - - return (int) $date[5]; - } - - /** - * Returns a timestamp - * - * @param int year (2003) - * @param int month (9) - * @param int day (13) - * @param int hour (13) - * @param int minute (34) - * @param int second (53) - * - * @return int Unix timestamp - */ - public function dateToStamp($y, $m, $d, $h = 0, $i = 0, $s = 0) - { - static $dates = []; - if (!isset($dates[$y][$m][$d][$h][$i][$s])) { - $dates[$y][$m][$d][$h][$i][$s] = @mktime($h, $i, $s, $m, $d, $y); - } - - return $dates[$y][$m][$d][$h][$i][$s]; - } - - /** - * The upper limit on years that the Calendar Engine can work with - * - * @return int (2037) - */ - public function getMaxYears() - { - return 2037; - } - - /** - * The lower limit on years that the Calendar Engine can work with - * - * @return int (1970 if it's Windows and 1902 for all other OSs) - */ - public function getMinYears() - { - return $min = strpos(PHP_OS, 'WIN') === false ? 1902 : 1970; - } - - /** - * Returns the number of months in a year - * - * @return int (12) - */ - public function getMonthsInYear($y = null) - { - return 12; - } - - /** - * Returns the number of days in a month, given year and month - * - * @param int year (2003) - * @param int month (9) - * - * @return int days in month - */ - public function getDaysInMonth($y, $m) - { - $stamp = self::dateToStamp($y, $m, 1); - $date = self::stampCollection($stamp); - - return $date[6]; - } - - /** - * Returns numeric representation of the day of the week in a month, - * given year and month - * - * @param int year (2003) - * @param int month (9) - * - * @return int from 0 to 6 - */ - public function getFirstDayInMonth($y, $m) - { - $stamp = self::dateToStamp($y, $m, 1); - $date = self::stampCollection($stamp); - - return $date[8]; - } - - /** - * Returns the number of days in a week - * - * @param int year (2003) - * @param int month (9) - * @param int day (4) - * - * @return int (7) - */ - public function getDaysInWeek($y = null, $m = null, $d = null) - { - return 7; - } - - /** - * Returns the number of the week in the year (ISO-8601), given a date - * - * @param int year (2003) - * @param int month (9) - * @param int day (4) - * - * @return int week number - */ - public function getWeekNInYear($y, $m, $d) - { - $stamp = self::dateToStamp($y, $m, $d); - $date = self::stampCollection($stamp); - - return $date[7]; - } - - /** - * Returns the number of the week in the month, given a date - * - * @param int year (2003) - * @param int month (9) - * @param int day (4) - * @param int first day of the week (default: monday) - * - * @return int week number - */ - public function getWeekNInMonth($y, $m, $d, $firstDay = 1) - { - $weekEnd = ($firstDay == 0) ? $this->getDaysInWeek() - 1 : $firstDay - 1; - $end_of_week = 1; - while (@date('w', @mktime(0, 0, 0, $m, $end_of_week, $y)) != $weekEnd) { - ++$end_of_week; // find first weekend of the month - } - $w = 1; - while ($d > $end_of_week) { - ++$w; - $end_of_week += $this->getDaysInWeek(); - } - - return $w; - } - - /** - * Returns the number of weeks in the month - * - * @param int year (2003) - * @param int month (9) - * @param int first day of the week (default: monday) - * - * @return int weeks number - */ - public function getWeeksInMonth($y, $m, $firstDay = 1) - { - $FDOM = $this->getFirstDayInMonth($y, $m); - if ($FDOM == 0) { - $FDOM = $this->getDaysInWeek(); - } - if ($FDOM > $firstDay) { - $daysInTheFirstWeek = $this->getDaysInWeek() - $FDOM + $firstDay; - $weeks = 1; - } else { - $daysInTheFirstWeek = $firstDay - $FDOM; - $weeks = 0; - } - $daysInTheFirstWeek %= $this->getDaysInWeek(); - - return (int) (ceil(($this->getDaysInMonth($y, $m) - $daysInTheFirstWeek) / - $this->getDaysInWeek()) + $weeks); - } - - /** - * Returns the number of the day of the week (0=sunday, 1=monday...) - * - * @param int year (2003) - * @param int month (9) - * @param int day (4) - * - * @return int weekday number - */ - public function getDayOfWeek($y, $m, $d) - { - $stamp = self::dateToStamp($y, $m, $d); - $date = self::stampCollection($stamp); - - return $date[8]; - } - - /** - * Returns a list of integer days of the week beginning 0 - * - * @param int year (2003) - * @param int month (9) - * @param int day (4) - * - * @return array (0,1,2,3,4,5,6) 1 = Monday - */ - public function getWeekDays($y = null, $m = null, $d = null) - { - return [0, 1, 2, 3, 4, 5, 6]; - } - - /** - * Returns the default first day of the week - * - * @param int year (2003) - * @param int month (9) - * @param int day (4) - * - * @return int (default 1 = Monday) - */ - public function getFirstDayOfWeek($y = null, $m = null, $d = null) - { - return 1; - } - - /** - * Returns the number of hours in a day - * - * @return int (24) - */ - public function getHoursInDay($y = null, $m = null, $d = null) - { - return 24; - } - - /** - * Returns the number of minutes in an hour - * - * @return int (60) - */ - public function getMinutesInHour($y = null, $m = null, $d = null, $h = null) - { - return 60; - } - - /** - * Returns the number of seconds in a minutes - * - * @return int (60) - */ - public function getSecondsInMinute($y = null, $m = null, $d = null, $h = null, $i = null) - { - return 60; - } -} diff --git a/data/module/Calendar/Factory.php b/data/module/Calendar/Factory.php deleted file mode 100644 index 0a07635fb5..0000000000 --- a/data/module/Calendar/Factory.php +++ /dev/null @@ -1,155 +0,0 @@ - | -// | Lorenzo Alberton
- * require_once 'Calendar/Factory.php';
- * define ('CALENDAR_MONTH_STATE',CALENDAR_USE_MONTH_WEEKDAYS); // Use Calendar_Month_Weekdays
- * // define ('CALENDAR_MONTH_STATE',CALENDAR_USE_MONTH_WEEKS); // Use Calendar_Month_Weeks
- * // define ('CALENDAR_MONTH_STATE',CALENDAR_USE_MONTH); // Use Calendar_Month
- *
- * It defaults to building Calendar_Month objects.
- * require_once 'Calendar'.DIRECTORY_SEPARATOR.'Hour.php';
- * $Hour = & new Calendar_Hour(2003, 10, 21, 15); // Oct 21st 2003, 3pm
- * $Hour->build(); // Build Calendar_Minute objects
- * while ($Minute = & $Hour->fetch()) {
- * echo $Minute->thisMinute().'
';
- * }
- *
- */
-class Calendar_Hour extends Calendar
-{
- /**
- * Constructs Calendar_Hour
- *
- * @param int year e.g. 2003
- * @param int month e.g. 5
- * @param int day e.g. 11
- * @param int hour e.g. 13
- */
- public function __construct($y, $m, $d, $h)
- {
- parent::__construct($y, $m, $d, $h);
- }
-
- /**
- * Builds the Minutes in the Hour
- *
- * @param array (optional) Calendar_Minute objects representing selected dates
- *
- * @return bool
- */
- public function build($sDates = [])
- {
- require_once CALENDAR_ROOT.'Minute.php';
- $mIH = $this->cE->getMinutesInHour($this->year, $this->month, $this->day,
- $this->hour);
- for ($i = 0; $i < $mIH; $i++) {
- $this->children[$i] =
- new Calendar_Minute($this->year, $this->month, $this->day,
- $this->hour, $i);
- }
- if (count($sDates) > 0) {
- $this->setSelection($sDates);
- }
-
- return true;
- }
-
- /**
- * Called from build()
- *
- * @param array
- *
- * @return void
- */
- public function setSelection($sDates)
- {
- foreach ($sDates as $sDate) {
- if ($this->year == $sDate->thisYear()
- && $this->month == $sDate->thisMonth()
- && $this->day == $sDate->thisDay()
- && $this->hour == $sDate->thisHour()) {
- $key = (int) $sDate->thisMinute();
- if (isset($this->children[$key])) {
- $sDate->setSelected();
- $this->children[$key] = $sDate;
- }
- }
- }
- }
-}
diff --git a/data/module/Calendar/Minute.php b/data/module/Calendar/Minute.php
deleted file mode 100644
index a02f046843..0000000000
--- a/data/module/Calendar/Minute.php
+++ /dev/null
@@ -1,114 +0,0 @@
- |
-// +----------------------------------------------------------------------+
-//
-// $Id: Minute.php,v 1.1 2004/05/24 22:25:42 quipo Exp $
-//
-/*
- * @package Calendar
- * @version $Id$
- */
-
-/*
- * Allows Calendar include path to be redefined
- * @ignore
- */
-if (!defined('CALENDAR_ROOT')) {
- define('CALENDAR_ROOT', 'Calendar'.DIRECTORY_SEPARATOR);
-}
-
-/**
- * Load Calendar base class
- */
-require_once CALENDAR_ROOT.'Calendar.php';
-
-/**
- * Represents a Minute and builds Seconds
- *
- * require_once 'Calendar'.DIRECTORY_SEPARATOR.'Minute.php';
- * $Minute = & new Calendar_Minute(2003, 10, 21, 15, 31); // Oct 21st 2003, 3:31pm
- * $Minute->build(); // Build Calendar_Second objects
- * while ($Second = & $Minute->fetch()) {
- * echo $Second->thisSecond().'
';
- * }
- *
- */
-class Calendar_Minute extends Calendar
-{
- /**
- * Constructs Minute
- *
- * @param int year e.g. 2003
- * @param int month e.g. 5
- * @param int day e.g. 11
- * @param int hour e.g. 13
- * @param int minute e.g. 31
- */
- public function __construct($y, $m, $d, $h, $i)
- {
- parent::__construct($y, $m, $d, $h, $i);
- }
-
- /**
- * Builds the Calendar_Second objects
- *
- * @param array (optional) Calendar_Second objects representing selected dates
- *
- * @return bool
- */
- public function build($sDates = [])
- {
- require_once CALENDAR_ROOT.'Second.php';
- $sIM = $this->cE->getSecondsInMinute($this->year, $this->month,
- $this->day, $this->hour, $this->minute);
- for ($i = 0; $i < $sIM; $i++) {
- $this->children[$i] = new Calendar_Second($this->year, $this->month,
- $this->day, $this->hour, $this->minute, $i);
- }
- if (count($sDates) > 0) {
- $this->setSelection($sDates);
- }
-
- return true;
- }
-
- /**
- * Called from build()
- *
- * @param array
- *
- * @return void
- */
- public function setSelection($sDates)
- {
- foreach ($sDates as $sDate) {
- if ($this->year == $sDate->thisYear()
- && $this->month == $sDate->thisMonth()
- && $this->day == $sDate->thisDay()
- && $this->hour == $sDate->thisHour()
- && $this->minute == $sDate->thisMinute()) {
- $key = (int) $sDate->thisSecond();
- if (isset($this->children[$key])) {
- $sDate->setSelected();
- $this->children[$key] = $sDate;
- }
- }
- }
- }
-}
diff --git a/data/module/Calendar/Month.php b/data/module/Calendar/Month.php
deleted file mode 100644
index 1bcd398d46..0000000000
--- a/data/module/Calendar/Month.php
+++ /dev/null
@@ -1,118 +0,0 @@
- |
-// +----------------------------------------------------------------------+
-//
-// $Id: Month.php,v 1.3 2005/10/22 10:10:26 quipo Exp $
-//
-/*
- * @package Calendar
- * @version $Id$
- */
-
-/*
- * Allows Calendar include path to be redefined
- * @ignore
- */
-if (!defined('CALENDAR_ROOT')) {
- define('CALENDAR_ROOT', 'Calendar'.DIRECTORY_SEPARATOR);
-}
-
-/**
- * Load Calendar base class
- */
-require_once CALENDAR_ROOT.'Calendar.php';
-
-/**
- * Represents a Month and builds Days
- *
- * require_once 'Calendar/Month.php';
- * $Month = & new Calendar_Month(2003, 10); // Oct 2003
- * $Month->build(); // Build Calendar_Day objects
- * while ($Day = & $Month->fetch()) {
- * echo $Day->thisDay().'
';
- * }
- *
- */
-class Calendar_Month extends Calendar
-{
- /** @var int */
- public $firstDay;
-
- /**
- * Constructs Calendar_Month
- *
- * @param int $y year e.g. 2003
- * @param int $m month e.g. 5
- * @param int $firstDay first day of the week [optional]
- */
- public function __construct($y, $m, $firstDay = null)
- {
- parent::__construct($y, $m);
- $this->firstDay = $this->defineFirstDayOfWeek($firstDay);
- }
-
- /**
- * Builds Day objects for this Month. Creates as many Calendar_Day objects
- * as there are days in the month
- *
- * @param array (optional) Calendar_Day objects representing selected dates
- *
- * @return bool
- */
- public function build($sDates = [])
- {
- require_once CALENDAR_ROOT.'Day.php';
- $daysInMonth = $this->cE->getDaysInMonth($this->year, $this->month);
- for ($i = 1; $i <= $daysInMonth; $i++) {
- $this->children[$i] = new Calendar_Day($this->year, $this->month, $i);
- }
- if (count($sDates) > 0) {
- $this->setSelection($sDates);
- }
-
- return true;
- }
-
- /**
- * Called from build()
- *
- * @param array
- *
- * @return void
- */
- public function setSelection($sDates)
- {
- foreach ($sDates as $sDate) {
- if ($this->year == $sDate->thisYear()
- && $this->month == $sDate->thisMonth()
- ) {
- $key = $sDate->thisDay();
- if (isset($this->children[$key])) {
- $sDate->setSelected();
- $class = strtolower(get_class($sDate));
- if ($class == 'calendar_day' || $class == 'calendar_decorator') {
- $sDate->setFirst($this->children[$key]->isFirst());
- $sDate->setLast($this->children[$key]->isLast());
- }
- $this->children[$key] = $sDate;
- }
- }
- }
- }
-}
diff --git a/data/module/Calendar/Month/Weekdays.php b/data/module/Calendar/Month/Weekdays.php
deleted file mode 100644
index 98e2d34576..0000000000
--- a/data/module/Calendar/Month/Weekdays.php
+++ /dev/null
@@ -1,190 +0,0 @@
- |
-// +----------------------------------------------------------------------+
-//
-// $Id: Weekdays.php,v 1.4 2005/10/22 10:28:49 quipo Exp $
-//
-/*
- * @package Calendar
- * @version $Id$
- */
-
-/*
- * Allows Calendar include path to be redefined
- * @ignore
- */
-if (!defined('CALENDAR_ROOT')) {
- define('CALENDAR_ROOT', 'Calendar'.DIRECTORY_SEPARATOR);
-}
-
-/**
- * Load Calendar base class
- */
-require_once CALENDAR_ROOT.'Calendar.php';
-
-/**
- * Load base month
- */
-require_once CALENDAR_ROOT.'Month.php';
-
-/**
- * Represents a Month and builds Days in tabular form
- * require_once 'Calendar/Month/Weekdays.php';
- * $Month = & new Calendar_Month_Weekdays(2003, 10); // Oct 2003
- * $Month->build(); // Build Calendar_Day objects
- * while ($Day = & $Month->fetch()) {
- * if ($Day->isFirst()) {
- * echo '';
- * }
- * if ($Day->isEmpty()) {
- * echo ' ';
- * } else {
- * echo ''.$Day->thisDay().' ';
- * }
- * if ($Day->isLast()) {
- * echo ' ';
- * }
- * }
- *
- */
-class Calendar_Month_Weekdays extends Calendar_Month
-{
- /**
- * Instance of Calendar_Table_Helper
- *
- * @var Calendar_Table_Helper
- */
- public $tableHelper;
-
- /**
- * First day of the week
- *
- * @var string
- */
- public $firstDay;
-
- /**
- * Constructs Calendar_Month_Weekdays
- *
- * @param int year e.g. 2003
- * @param int month e.g. 5
- * @param int (optional) first day of week (e.g. 0 for Sunday, 2 for Tuesday etc.)
- */
- public function __construct($y, $m, $firstDay = null)
- {
- parent::__construct($y, $m, $firstDay);
- }
-
- /**
- * Builds Day objects in tabular form, to allow display of calendar month
- * with empty cells if the first day of the week does not fall on the first
- * day of the month.
- *
- * @see Calendar_Day::isEmpty()
- * @see Calendar_Day_Base::isFirst()
- * @see Calendar_Day_Base::isLast()
- *
- * @param array (optional) Calendar_Day objects representing selected dates
- *
- * @return bool
- */
- public function build($sDates = [])
- {
- require_once CALENDAR_ROOT.'Table/Helper.php';
- $this->tableHelper = new Calendar_Table_Helper($this, $this->firstDay);
- Calendar_Month::build($sDates);
- $this->buildEmptyDaysBefore();
- $this->shiftDays();
- $this->buildEmptyDaysAfter();
- $this->setWeekMarkers();
-
- return true;
- }
-
- /**
- * Prepends empty days before the real days in the month
- *
- * @return void
- */
- public function buildEmptyDaysBefore()
- {
- $eBefore = $this->tableHelper->getEmptyDaysBefore();
- for ($i = 0; $i < $eBefore; $i++) {
- $stamp = $this->cE->dateToStamp($this->year, $this->month, -$i);
- $Day = new Calendar_Day(
- $this->cE->stampToYear($stamp),
- $this->cE->stampToMonth($stamp),
- $this->cE->stampToDay($stamp));
- $Day->setEmpty();
- $Day->adjust();
- array_unshift($this->children, $Day);
- }
- }
-
- /**
- * Shifts the array of children forward, if necessary
- *
- * @return void
- */
- public function shiftDays()
- {
- if (isset($this->children[0])) {
- array_unshift($this->children, null);
- unset($this->children[0]);
- }
- }
-
- /**
- * Appends empty days after the real days in the month
- *
- * @return void
- */
- public function buildEmptyDaysAfter()
- {
- $eAfter = $this->tableHelper->getEmptyDaysAfter();
- $sDOM = $this->tableHelper->getNumTableDaysInMonth();
- for ($i = 1; $i <= $sDOM - $eAfter; $i++) {
- $Day = new Calendar_Day($this->year, $this->month + 1, $i);
- $Day->setEmpty();
- $Day->adjust();
- $this->children[] = $Day;
- }
- }
-
- /**
- * Sets the "markers" for the beginning and of a of week, in the
- * built Calendar_Day children
- *
- * @return void
- */
- public function setWeekMarkers()
- {
- $dIW = $this->cE->getDaysInWeek(
- $this->thisYear(),
- $this->thisMonth(),
- $this->thisDay()
- );
- $sDOM = $this->tableHelper->getNumTableDaysInMonth();
- for ($i = 1; $i <= $sDOM; $i += $dIW) {
- $this->children[$i]->setFirst();
- $this->children[$i + ($dIW - 1)]->setLast();
- }
- }
-}
diff --git a/data/module/Calendar/Month/Weeks.php b/data/module/Calendar/Month/Weeks.php
deleted file mode 100644
index ded5db1536..0000000000
--- a/data/module/Calendar/Month/Weeks.php
+++ /dev/null
@@ -1,139 +0,0 @@
- |
-// | Lorenzo Alberton
- * require_once 'Calendar'.DIRECTORY_SEPARATOR.'Month'.DIRECTORY_SEPARATOR.'Weeks.php';
- * $Month = & new Calendar_Month_Weeks(2003, 10); // Oct 2003
- * $Month->build(); // Build Calendar_Day objects
- * while ($Week = & $Month->fetch()) {
- * echo $Week->thisWeek().'
';
- * }
- *
- */
-class Calendar_Month_Weeks extends Calendar_Month
-{
- /**
- * Instance of Calendar_Table_Helper
- *
- * @var Calendar_Table_Helper
- */
- public $tableHelper;
-
- /**
- * First day of the week
- *
- * @var string
- */
- public $firstDay;
-
- /**
- * Constructs Calendar_Month_Weeks
- *
- * @param int year e.g. 2003
- * @param int month e.g. 5
- * @param int (optional) first day of week (e.g. 0 for Sunday, 2 for Tuesday etc.)
- */
- public function __construct($y, $m, $firstDay = null)
- {
- parent::__construct($y, $m, $firstDay);
- }
-
- /**
- * Builds Calendar_Week objects for the Month. Note that Calendar_Week
- * builds Calendar_Day object in tabular form (with Calendar_Day->empty)
- *
- * @param array (optional) Calendar_Week objects representing selected dates
- *
- * @return bool
- */
- public function build($sDates = [])
- {
- require_once CALENDAR_ROOT.'Table/Helper.php';
- $this->tableHelper = new Calendar_Table_Helper($this, $this->firstDay);
- require_once CALENDAR_ROOT.'Week.php';
- $numWeeks = $this->tableHelper->getNumWeeks();
- for ($i = 1, $d = 1; $i <= $numWeeks; $i++,
- $d += $this->cE->getDaysInWeek(
- $this->thisYear(),
- $this->thisMonth(),
- $this->thisDay())) {
- $this->children[$i] = new Calendar_Week(
- $this->year, $this->month, $d, $this->tableHelper->getFirstDay());
- }
- // used to set empty days
- $this->children[1]->setFirst(true);
- $this->children[$numWeeks]->setLast(true);
-
- // Handle selected weeks here
- if (count($sDates) > 0) {
- $this->setSelection($sDates);
- }
-
- return true;
- }
-
- /**
- * Called from build()
- *
- * @param array
- *
- * @return void
- */
- public function setSelection($sDates)
- {
- foreach ($sDates as $sDate) {
- if ($this->year == $sDate->thisYear()
- && $this->month == $sDate->thisMonth()) {
- $key = $sDate->thisWeek('n_in_month');
- if (isset($this->children[$key])) {
- $this->children[$key]->setSelected();
- }
- }
- }
- }
-}
diff --git a/data/module/Calendar/Second.php b/data/module/Calendar/Second.php
deleted file mode 100644
index ae86eb8acf..0000000000
--- a/data/module/Calendar/Second.php
+++ /dev/null
@@ -1,102 +0,0 @@
- |
-// +----------------------------------------------------------------------+
-//
-// $Id: Second.php,v 1.1 2004/05/24 22:25:42 quipo Exp $
-//
-/*
- * @package Calendar
- * @version $Id$
- */
-
-/*
- * Allows Calendar include path to be redefined
- * @ignore
- */
-if (!defined('CALENDAR_ROOT')) {
- define('CALENDAR_ROOT', 'Calendar'.DIRECTORY_SEPARATOR);
-}
-
-/**
- * Load Calendar base class
- */
-require_once CALENDAR_ROOT.'Calendar.php';
-
-/**
- * Represents a Second
- * $Day = new Calendar_Day(2003, 10, 23);
- * $Uri = & new Calendar_Util_Uri('year', 'month', 'day');
- * echo $Uri->prev($Day,'month'); // Displays year=2003&month=10
- * echo $Uri->prev($Day,'day'); // Displays year=2003&month=10&day=22
- * $Uri->seperator = '/';
- * $Uri->scalar = true;
- * echo $Uri->prev($Day,'month'); // Displays 2003/10
- * echo $Uri->prev($Day,'day'); // Displays 2003/10/22
- *
- */
-class Calendar_Util_Uri
-{
- /**
- * Uri fragments for year, month, day etc.
- *
- * @var array
- */
- public $uris = [];
-
- /**
- * String to separate fragments with.
- * Set to just & for HTML.
- * For a scalar URL you might use / as the seperator
- *
- * @var string (default XHTML &)
- */
- public $separator = '&';
-
- /**
- * To output a "scalar" string - variable names omitted.
- * Used for urls like index.php/2004/8/12
- *
- * @var bool (default false)
- */
- public $scalar = false;
-
- /**
- * Constructs Calendar_Decorator_Uri
- * The term "fragment" means name of a calendar GET variables in the URL
- *
- * @param string URI fragment for year
- * @param string (optional) URI fragment for month
- * @param string (optional) URI fragment for day
- * @param string (optional) URI fragment for hour
- * @param string (optional) URI fragment for minute
- * @param string (optional) URI fragment for second
- */
- public function __construct($y, $m = null, $d = null, $h = null, $i = null, $s = null)
- {
- $this->setFragments($y, $m, $d, $h, $i, $s);
- }
-
- /**
- * Sets the URI fragment names
- *
- * @param string URI fragment for year
- * @param string (optional) URI fragment for month
- * @param string (optional) URI fragment for day
- * @param string (optional) URI fragment for hour
- * @param string (optional) URI fragment for minute
- * @param string (optional) URI fragment for second
- *
- * @return void
- */
- public function setFragments($y, $m = null, $d = null, $h = null, $i = null, $s = null)
- {
- if (!is_null($y)) {
- $this->uris['Year'] = $y;
- }
- if (!is_null($m)) {
- $this->uris['Month'] = $m;
- }
- if (!is_null($d)) {
- $this->uris['Day'] = $d;
- }
- if (!is_null($h)) {
- $this->uris['Hour'] = $h;
- }
- if (!is_null($i)) {
- $this->uris['Minute'] = $i;
- }
- if (!is_null($s)) {
- $this->uris['Second'] = $s;
- }
- }
-
- /**
- * Gets the URI string for the previous calendar unit
- *
- * @param object subclassed from Calendar e.g. Calendar_Month
- * @param string calendar unit ( must be year, month, week, day, hour, minute or second)
- *
- * @return string
- */
- public function prev($Calendar, $unit)
- {
- $method = 'prev'.$unit;
- $stamp = $Calendar->{$method}('timestamp');
-
- return $this->buildUriString($Calendar, $method, $stamp);
- }
-
- /**
- * Gets the URI string for the current calendar unit
- *
- * @param object subclassed from Calendar e.g. Calendar_Month
- * @param string calendar unit ( must be year, month, week, day, hour, minute or second)
- *
- * @return string
- */
- public function this($Calendar, $unit)
- {
- $method = 'this'.$unit;
- $stamp = $Calendar->{$method}('timestamp');
-
- return $this->buildUriString($Calendar, $method, $stamp);
- }
-
- /**
- * Gets the URI string for the next calendar unit
- *
- * @param object subclassed from Calendar e.g. Calendar_Month
- * @param string calendar unit ( must be year, month, week, day, hour, minute or second)
- *
- * @return string
- */
- public function next($Calendar, $unit)
- {
- $method = 'next'.$unit;
- $stamp = $Calendar->{$method}('timestamp');
-
- return $this->buildUriString($Calendar, $method, $stamp);
- }
-
- /**
- * Build the URI string
- *
- * @param string method substring
- * @param int timestamp
- *
- * @return string build uri string
- */
- public function buildUriString($Calendar, $method, $stamp)
- {
- $uriString = '';
- $cE = &$Calendar->getEngine();
- $separator = '';
- foreach ($this->uris as $unit => $uri) {
- $call = 'stampTo'.$unit;
- $uriString .= $separator;
- if (!$this->scalar) {
- $uriString .= $uri.'=';
- }
- $uriString .= $cE->{$call}($stamp);
- $separator = $this->separator;
- }
-
- return $uriString;
- }
-}
diff --git a/data/module/Calendar/Validator.php b/data/module/Calendar/Validator.php
deleted file mode 100644
index bbb561d2ec..0000000000
--- a/data/module/Calendar/Validator.php
+++ /dev/null
@@ -1,354 +0,0 @@
- |
-// +----------------------------------------------------------------------+
-//
-// $Id: Validator.php,v 1.1 2004/05/24 22:25:42 quipo Exp $
-//
-/*
- * @package Calendar
- * @version $Id$
- */
-
-/*
- * Validation Error Messages
- */
-if (!defined('CALENDAR_VALUE_TOOSMALL')) {
- define('CALENDAR_VALUE_TOOSMALL', 'Too small: min = ');
-}
-if (!defined('CALENDAR_VALUE_TOOLARGE')) {
- define('CALENDAR_VALUE_TOOLARGE', 'Too large: max = ');
-}
-
-/**
- * Used to validate any given Calendar date object. Instances of this class
- * can be obtained from any data object using the getValidator method
- *
- * @see Calendar::getValidator()
- */
-class Calendar_Validator
-{
- /**
- * Instance of the Calendar date object to validate
- *
- * @var object
- */
- public $calendar;
-
- /**
- * Instance of the Calendar_Engine
- *
- * @var object
- */
- public $cE;
-
- /**
- * Array of errors for validation failures
- *
- * @var array
- */
- public $errors = [];
-
- /**
- * Constructs Calendar_Validator
- *
- * @param object subclass of Calendar
- */
- public function __construct(&$calendar)
- {
- $this->calendar = &$calendar;
- $this->cE = &$calendar->getEngine();
- }
-
- /**
- * Calls all the other isValidXXX() methods in the validator
- *
- * @return bool
- */
- public function isValid()
- {
- $checks = ['isValidYear', 'isValidMonth', 'isValidDay',
- 'isValidHour', 'isValidMinute', 'isValidSecond', ];
- $valid = true;
- foreach ($checks as $check) {
- if (!$this->{$check}()) {
- $valid = false;
- }
- }
-
- return $valid;
- }
-
- /**
- * Check whether this is a valid year
- *
- * @return bool
- */
- public function isValidYear()
- {
- $y = $this->calendar->thisYear();
- $min = $this->cE->getMinYears();
- if ($min > $y) {
- $this->errors[] = new Calendar_Validation_Error(
- 'Year', $y, CALENDAR_VALUE_TOOSMALL.$min);
-
- return false;
- }
- $max = $this->cE->getMaxYears();
- if ($y > $max) {
- $this->errors[] = new Calendar_Validation_Error(
- 'Year', $y, CALENDAR_VALUE_TOOLARGE.$max);
-
- return false;
- }
-
- return true;
- }
-
- /**
- * Check whether this is a valid month
- *
- * @return bool
- */
- public function isValidMonth()
- {
- $m = $this->calendar->thisMonth();
- $min = 1;
- if ($min > $m) {
- $this->errors[] = new Calendar_Validation_Error(
- 'Month', $m, CALENDAR_VALUE_TOOSMALL.$min);
-
- return false;
- }
- $max = $this->cE->getMonthsInYear($this->calendar->thisYear());
- if ($m > $max) {
- $this->errors[] = new Calendar_Validation_Error(
- 'Month', $m, CALENDAR_VALUE_TOOLARGE.$max);
-
- return false;
- }
-
- return true;
- }
-
- /**
- * Check whether this is a valid day
- *
- * @return bool
- */
- public function isValidDay()
- {
- $d = $this->calendar->thisDay();
- $min = 1;
- if ($min > $d) {
- $this->errors[] = new Calendar_Validation_Error(
- 'Day', $d, CALENDAR_VALUE_TOOSMALL.$min);
-
- return false;
- }
- $max = $this->cE->getDaysInMonth(
- $this->calendar->thisYear(), $this->calendar->thisMonth());
- if ($d > $max) {
- $this->errors[] = new Calendar_Validation_Error(
- 'Day', $d, CALENDAR_VALUE_TOOLARGE.$max);
-
- return false;
- }
-
- return true;
- }
-
- /**
- * Check whether this is a valid hour
- *
- * @return bool
- */
- public function isValidHour()
- {
- $h = $this->calendar->thisHour();
- $min = 0;
- if ($min > $h) {
- $this->errors[] = new Calendar_Validation_Error(
- 'Hour', $h, CALENDAR_VALUE_TOOSMALL.$min);
-
- return false;
- }
- $max = ($this->cE->getHoursInDay($this->calendar->thisDay()) - 1);
- if ($h > $max) {
- $this->errors[] = new Calendar_Validation_Error(
- 'Hour', $h, CALENDAR_VALUE_TOOLARGE.$max);
-
- return false;
- }
-
- return true;
- }
-
- /**
- * Check whether this is a valid minute
- *
- * @return bool
- */
- public function isValidMinute()
- {
- $i = $this->calendar->thisMinute();
- $min = 0;
- if ($min > $i) {
- $this->errors[] = new Calendar_Validation_Error(
- 'Minute', $i, CALENDAR_VALUE_TOOSMALL.$min);
-
- return false;
- }
- $max = ($this->cE->getMinutesInHour($this->calendar->thisHour()) - 1);
- if ($i > $max) {
- $this->errors[] = new Calendar_Validation_Error(
- 'Minute', $i, CALENDAR_VALUE_TOOLARGE.$max);
-
- return false;
- }
-
- return true;
- }
-
- /**
- * Check whether this is a valid second
- *
- * @return bool
- */
- public function isValidSecond()
- {
- $s = $this->calendar->thisSecond();
- $min = 0;
- if ($min > $s) {
- $this->errors[] = new Calendar_Validation_Error(
- 'Second', $s, CALENDAR_VALUE_TOOSMALL.$min);
-
- return false;
- }
- $max = ($this->cE->getSecondsInMinute($this->calendar->thisMinute()) - 1);
- if ($s > $max) {
- $this->errors[] = new Calendar_Validation_Error(
- 'Second', $s, CALENDAR_VALUE_TOOLARGE.$max);
-
- return false;
- }
-
- return true;
- }
-
- /**
- * Iterates over any validation errors
- *
- * @return mixed either Calendar_Validation_Error or false
- */
- public function fetch()
- {
- $error = current($this->errors);
- next($this->errors);
- if ($error) {
- return $error['value'];
- } else {
- reset($this->errors);
-
- return false;
- }
- }
-}
-
-/**
- * For Validation Error messages
- *
- * @see Calendar::fetch()
- */
-class Calendar_Validation_Error
-{
- /**
- * Date unit (e.g. month,hour,second) which failed test
- *
- * @var string
- */
- public $unit;
-
- /**
- * Value of unit which failed test
- *
- * @var int
- */
- public $value;
-
- /**
- * Validation error message
- *
- * @var string
- */
- public $message;
-
- /**
- * Constructs Calendar_Validation_Error
- *
- * @param string Date unit (e.g. month,hour,second)
- * @param int Value of unit which failed test
- * @param string Validation error message
- */
- public function __construct($unit, $value, $message)
- {
- $this->unit = $unit;
- $this->value = $value;
- $this->message = $message;
- }
-
- /**
- * Returns the Date unit
- *
- * @return string
- */
- public function getUnit()
- {
- return $this->unit;
- }
-
- /**
- * Returns the value of the unit
- *
- * @return int
- */
- public function getValue()
- {
- return $this->value;
- }
-
- /**
- * Returns the validation error message
- *
- * @return string
- */
- public function getMessage()
- {
- return $this->message;
- }
-
- /**
- * Returns a string containing the unit, value and error message
- *
- * @return string
- */
- public function toString()
- {
- return $this->unit.' = '.$this->value.' ['.$this->message.']';
- }
-}
diff --git a/data/module/Calendar/Week.php b/data/module/Calendar/Week.php
deleted file mode 100644
index aa48fcc812..0000000000
--- a/data/module/Calendar/Week.php
+++ /dev/null
@@ -1,400 +0,0 @@
- |
-// | Lorenzo Alberton
- * require_once 'Calendar'.DIRECTORY_SEPARATOR.'Week.php';
- * $Week = & new Calendar_Week(2003, 10, 1); Oct 2003, 1st tabular week
- * echo '';
- * while ($Day = & $Week->fetch()) {
- * if ($Day->isEmpty()) {
- * echo ' ';
- * } else {
- * echo ''.$Day->thisDay().' ';
- * }
- * }
- * echo ' ';
- *
- */
-class Calendar_Week extends Calendar
-{
- /**
- * Instance of Calendar_Table_Helper
- *
- * @var Calendar_Table_Helper
- */
- public $tableHelper;
-
- /**
- * Stores the timestamp of the first day of this week
- *
- * @var object
- */
- public $thisWeek;
-
- /**
- * Stores the timestamp of first day of previous week
- *
- * @var object
- */
- public $prevWeek;
-
- /**
- * Stores the timestamp of first day of next week
- *
- * @var object
- */
- public $nextWeek;
-
- /**
- * Used by build() to set empty days
- *
- * @var bool
- */
- public $firstWeek = false;
-
- /**
- * Used by build() to set empty days
- *
- * @var bool
- */
- public $lastWeek = false;
-
- /**
- * First day of the week (0=sunday, 1=monday...)
- *
- * @var bool
- */
- public $firstDay = 1;
-
- /**
- * Constructs Week
- *
- * @param int year e.g. 2003
- * @param int month e.g. 5
- * @param int a day of the desired week
- * @param int (optional) first day of week (e.g. 0 for Sunday, 2 for Tuesday etc.)
- */
- public function __construct($y, $m, $d, $firstDay = null)
- {
- require_once CALENDAR_ROOT.'Table/Helper.php';
- parent::__construct($y, $m, $d);
- $this->firstDay = $this->defineFirstDayOfWeek($firstDay);
- $this->tableHelper = new Calendar_Table_Helper($this, $this->firstDay);
- $this->thisWeek = $this->tableHelper->getWeekStart($y, $m, $d, $this->firstDay);
- $this->prevWeek = $this->tableHelper->getWeekStart($y, $m, $d - $this->cE->getDaysInWeek(
- $this->thisYear(),
- $this->thisMonth(),
- $this->thisDay()), $this->firstDay);
- $this->nextWeek = $this->tableHelper->getWeekStart($y, $m, $d + $this->cE->getDaysInWeek(
- $this->thisYear(),
- $this->thisMonth(),
- $this->thisDay()), $this->firstDay);
- }
-
- /**
- * Defines the calendar by a timestamp (Unix or ISO-8601), replacing values
- * passed to the constructor
- *
- * @param int|string Unix or ISO-8601 timestamp
- *
- * @return void
- */
- public function setTimestamp($ts)
- {
- parent::setTimestamp($ts);
- $this->thisWeek = $this->tableHelper->getWeekStart(
- $this->year, $this->month, $this->day, $this->firstDay
- );
- $this->prevWeek = $this->tableHelper->getWeekStart(
- $this->year, $this->month, $this->day - $this->cE->getDaysInWeek(
- $this->thisYear(),
- $this->thisMonth(),
- $this->thisDay()), $this->firstDay
- );
- $this->nextWeek = $this->tableHelper->getWeekStart(
- $this->year, $this->month, $this->day + $this->cE->getDaysInWeek(
- $this->thisYear(),
- $this->thisMonth(),
- $this->thisDay()), $this->firstDay
- );
- }
-
- /**
- * Builds Calendar_Day objects for this Week
- *
- * @param array (optional) Calendar_Day objects representing selected dates
- *
- * @return bool
- */
- public function build($sDates = [])
- {
- require_once CALENDAR_ROOT.'Day.php';
- $year = $this->cE->stampToYear($this->thisWeek);
- $month = $this->cE->stampToMonth($this->thisWeek);
- $day = $this->cE->stampToDay($this->thisWeek);
- $end = $this->cE->getDaysInWeek(
- $this->thisYear(),
- $this->thisMonth(),
- $this->thisDay()
- );
-
- for ($i = 1; $i <= $end; $i++) {
- $stamp = $this->cE->dateToStamp($year, $month, $day++);
- $this->children[$i] = new Calendar_Day(
- $this->cE->stampToYear($stamp),
- $this->cE->stampToMonth($stamp),
- $this->cE->stampToDay($stamp));
- }
-
- // set empty days (@see Calendar_Month_Weeks::build())
- if ($this->firstWeek) {
- $eBefore = $this->tableHelper->getEmptyDaysBefore();
- for ($i = 1; $i <= $eBefore; $i++) {
- $this->children[$i]->setEmpty();
- }
- }
- if ($this->lastWeek) {
- $eAfter = $this->tableHelper->getEmptyDaysAfterOffset();
- for ($i = $eAfter + 1; $i <= $end; $i++) {
- $this->children[$i]->setEmpty();
- }
- }
-
- if (count($sDates) > 0) {
- $this->setSelection($sDates);
- }
-
- return true;
- }
-
- /**
- * @param bool
- *
- * @return void
- */
- public function setFirst($state = true)
- {
- $this->firstWeek = $state;
- }
-
- /**
- * @param bool
- *
- * @return void
- */
- public function setLast($state = true)
- {
- $this->lastWeek = $state;
- }
-
- /**
- * Called from build()
- *
- * @param array
- *
- * @return void
- */
- public function setSelection($sDates)
- {
- foreach ($sDates as $sDate) {
- foreach ($this->children as $key => $child) {
- if ($child->thisDay() == $sDate->thisDay() &&
- $child->thisMonth() == $sDate->thisMonth() &&
- $child->thisYear() == $sDate->thisYear()
- ) {
- $this->children[$key] = $sDate;
- $this->children[$key]->setSelected();
- }
- }
- }
- reset($this->children);
- }
-
- /**
- * Gets the value of the previous week, according to the requested format
- *
- * @param string $format ['timestamp' | 'n_in_month' | 'n_in_year' | 'array']
- *
- * @return mixed
- */
- public function prevWeek($format = 'n_in_month')
- {
- switch (strtolower($format)) {
- case 'int':
- case 'n_in_month':
- return ($this->firstWeek) ? null : $this->thisWeek('n_in_month') - 1;
- break;
- case 'n_in_year':
- return $this->cE->getWeekNInYear(
- $this->cE->stampToYear($this->prevWeek),
- $this->cE->stampToMonth($this->prevWeek),
- $this->cE->stampToDay($this->prevWeek));
- break;
- case 'array':
- return $this->toArray($this->prevWeek);
- break;
- case 'object':
- require_once CALENDAR_ROOT.'Factory.php';
-
- return Calendar_Factory::createByTimestamp('Week', $this->prevWeek);
- break;
- case 'timestamp':
- default:
- return $this->prevWeek;
- break;
- }
- }
-
- /**
- * Gets the value of the current week, according to the requested format
- *
- * @param string $format ['timestamp' | 'n_in_month' | 'n_in_year' | 'array']
- *
- * @return mixed
- */
- public function thisWeek($format = 'n_in_month')
- {
- switch (strtolower($format)) {
- case 'int':
- case 'n_in_month':
- if ($this->firstWeek) {
- return 1;
- }
- if ($this->lastWeek) {
- return $this->cE->getWeeksInMonth(
- $this->thisYear(),
- $this->thisMonth(),
- $this->firstDay);
- }
-
- return $this->cE->getWeekNInMonth(
- $this->thisYear(),
- $this->thisMonth(),
- $this->thisDay(),
- $this->firstDay);
- break;
- case 'n_in_year':
- return $this->cE->getWeekNInYear(
- $this->cE->stampToYear($this->thisWeek),
- $this->cE->stampToMonth($this->thisWeek),
- $this->cE->stampToDay($this->thisWeek));
- break;
- case 'array':
- return $this->toArray($this->thisWeek);
- break;
- case 'object':
- require_once CALENDAR_ROOT.'Factory.php';
-
- return Calendar_Factory::createByTimestamp('Week', $this->thisWeek);
- break;
- case 'timestamp':
- default:
- return $this->thisWeek;
- break;
- }
- }
-
- /**
- * Gets the value of the following week, according to the requested format
- *
- * @param string $format ['timestamp' | 'n_in_month' | 'n_in_year' | 'array']
- *
- * @return mixed
- */
- public function nextWeek($format = 'n_in_month')
- {
- switch (strtolower($format)) {
- case 'int':
- case 'n_in_month':
- return ($this->lastWeek) ? null : $this->thisWeek('n_in_month') + 1;
- break;
- case 'n_in_year':
- return $this->cE->getWeekNInYear(
- $this->cE->stampToYear($this->nextWeek),
- $this->cE->stampToMonth($this->nextWeek),
- $this->cE->stampToDay($this->nextWeek));
- break;
- case 'array':
- return $this->toArray($this->nextWeek);
- break;
- case 'object':
- require_once CALENDAR_ROOT.'Factory.php';
-
- return Calendar_Factory::createByTimestamp('Week', $this->nextWeek);
- break;
- case 'timestamp':
- default:
- return $this->nextWeek;
- break;
- }
- }
-
- /**
- * Returns the instance of Calendar_Table_Helper.
- * Called from Calendar_Validator::isValidWeek
- *
- * @return Calendar_Table_Helper
- */
- public function &getHelper()
- {
- return $this->tableHelper;
- }
-
- /**
- * Makes sure theres a value for $this->day
- *
- * @return void
- */
- public function findFirstDay()
- {
- if (!count($this->children) > 0) {
- $this->build();
- foreach ($this->children as $Day) {
- if (!$Day->isEmpty()) {
- $this->day = $Day->thisDay();
- break;
- }
- }
- }
- }
-}
diff --git a/data/module/Calendar/Year.php b/data/module/Calendar/Year.php
deleted file mode 100644
index 77a55f4188..0000000000
--- a/data/module/Calendar/Year.php
+++ /dev/null
@@ -1,118 +0,0 @@
- |
-// +----------------------------------------------------------------------+
-//
-// $Id: Year.php,v 1.4 2005/10/22 10:25:39 quipo Exp $
-//
-/*
- * @package Calendar
- * @version $Id$
- */
-
-/*
- * Allows Calendar include path to be redefined
- * @ignore
- */
-if (!defined('CALENDAR_ROOT')) {
- define('CALENDAR_ROOT', 'Calendar'.DIRECTORY_SEPARATOR);
-}
-
-/**
- * Load Calendar base class
- */
-require_once CALENDAR_ROOT.'Calendar.php';
-
-/**
- * Represents a Year and builds Months
- * require_once 'Calendar'.DIRECTORY_SEPARATOR.'Year.php';
- * $Year = & new Calendar_Year(2003, 10, 21); // 21st Oct 2003
- * $Year->build(); // Build Calendar_Month objects
- * while ($Month = & $Year->fetch()) {
- * echo $Month->thisMonth().'
';
- * }
- *
- */
-class Calendar_Year extends Calendar
-{
- /** @var string */
- public $firstDay;
-
- /**
- * Constructs Calendar_Year
- *
- * @param int year e.g. 2003
- */
- public function __construct($y)
- {
- parent::__construct($y);
- }
-
- /**
- * Builds the Months of the Year.
- * require_once 'Calendar/Calendar_Year.php';
- * define ('CALENDAR_MONTH_STATE',CALENDAR_USE_MONTH_WEEKDAYS); // Use Calendar_Month_Weekdays
- * // define ('CALENDAR_MONTH_STATE',CALENDAR_USE_MONTH_WEEKS); // Use Calendar_Month_Weeks
- * // define ('CALENDAR_MONTH_STATE',CALENDAR_USE_MONTH); // Use Calendar_Month
- *
- * It defaults to building Calendar_Month objects.
- *
- * @param array (optional) array of Calendar_Month objects representing selected dates
- * @param int (optional) first day of week (e.g. 0 for Sunday, 2 for Tuesday etc.)
- *
- * @return bool
- */
- public function build($sDates = [], $firstDay = null)
- {
- require_once CALENDAR_ROOT.'Factory.php';
- $this->firstDay = $this->defineFirstDayOfWeek($firstDay);
- $monthsInYear = $this->cE->getMonthsInYear($this->thisYear());
- for ($i = 1; $i <= $monthsInYear; $i++) {
- $this->children[$i] = Calendar_Factory::create('Month', $this->year, $i);
- }
- if (count($sDates) > 0) {
- $this->setSelection($sDates);
- }
-
- return true;
- }
-
- /**
- * Called from build()
- *
- * @param array
- *
- * @return void
- */
- public function setSelection($sDates)
- {
- foreach ($sDates as $sDate) {
- if ($this->year == $sDate->thisYear()) {
- $key = $sDate->thisMonth();
- if (isset($this->children[$key])) {
- $sDate->setSelected();
- $this->children[$key] = $sDate;
- }
- }
- }
- }
-}
diff --git a/data/module/HTTP/Request.php b/data/module/HTTP/Request.php
index b55823bfbd..25a304f7e3 100644
--- a/data/module/HTTP/Request.php
+++ b/data/module/HTTP/Request.php
@@ -302,14 +302,14 @@ class HTTP_Request
*
* @var array
*/
- public $_readTimeout = null;
+ public $_readTimeout;
/**
* Options to pass to Net_Socket::connect. See stream_context_create
*
* @var array
*/
- public $_socketOptions = null;
+ public $_socketOptions;
/**#@-*/
/**
@@ -401,7 +401,7 @@ public function _generateHostHeader()
$host = $this->_url->host.':'.$this->_url->port;
} elseif ($this->_url->port != 443 && strcasecmp($this->_url->protocol, 'https') == 0) {
$host = $this->_url->host.':'.$this->_url->port;
- } elseif ($this->_url->port == 443 && strcasecmp($this->_url->protocol, 'https') == 0 && strpos($this->_url->url, ':443') !== false) {
+ } elseif ($this->_url->port == 443 && strcasecmp($this->_url->protocol, 'https') == 0 && str_contains($this->_url->url, ':443')) {
$host = $this->_url->host.':'.$this->_url->port;
} else {
$host = $this->_url->host;
@@ -733,20 +733,20 @@ public function sendRequest($saveBody = true)
// RFC 2068, section 19.7.1: A client MUST NOT send the Keep-Alive
// connection token to a proxy server...
- if (isset($this->_proxy_host) && !empty($this->_requestHeaders['connection']) &&
- 'Keep-Alive' == $this->_requestHeaders['connection']) {
+ if (isset($this->_proxy_host) && !empty($this->_requestHeaders['connection'])
+ && 'Keep-Alive' == $this->_requestHeaders['connection']) {
$this->removeHeader('connection');
}
- $keepAlive = (HTTP_REQUEST_HTTP_VER_1_1 == $this->_http && empty($this->_requestHeaders['connection'])) ||
- (!empty($this->_requestHeaders['connection']) && 'Keep-Alive' == $this->_requestHeaders['connection']);
+ $keepAlive = (HTTP_REQUEST_HTTP_VER_1_1 == $this->_http && empty($this->_requestHeaders['connection']))
+ || (!empty($this->_requestHeaders['connection']) && 'Keep-Alive' == $this->_requestHeaders['connection']);
$sockets = &PEAR::getStaticProperty('HTTP_Request', 'sockets');
$sockKey = $host.':'.$port;
unset($this->_sock);
// There is a connected socket in the "static" property?
- if ($keepAlive && !empty($sockets[$sockKey]) &&
- !empty($sockets[$sockKey]->fp)) {
+ if ($keepAlive && !empty($sockets[$sockKey])
+ && !empty($sockets[$sockKey]->fp)) {
$this->_sock = &$sockets[$sockKey];
$err = null;
} else {
@@ -810,7 +810,7 @@ public function sendRequest($saveBody = true)
$this->_url = new Net_URL($redirect);
$this->addHeader('Host', $this->_generateHostHeader());
// Absolute path
- } elseif (strpos($redirect, '/') === 0) {
+ } elseif (str_starts_with($redirect, '/')) {
$this->_url->path = $redirect;
// Relative path
@@ -938,9 +938,9 @@ public function _buildRequest()
$request = $this->_method.' '.$url.' HTTP/'.$this->_http."\r\n";
- if (in_array($this->_method, $this->_bodyDisallowed) ||
- (0 == strlen($this->_body) && (HTTP_REQUEST_METHOD_POST != $this->_method ||
- (empty($this->_postData) && empty($this->_postFiles))))) {
+ if (in_array($this->_method, $this->_bodyDisallowed)
+ || (0 == strlen($this->_body) && (HTTP_REQUEST_METHOD_POST != $this->_method
+ || (empty($this->_postData) && empty($this->_postFiles))))) {
$this->removeHeader('Content-Type');
} else {
if (empty($this->_requestHeaders['content-type'])) {
@@ -965,8 +965,8 @@ public function _buildRequest()
$request .= "\r\n";
// Post data if it's an array
- } elseif (HTTP_REQUEST_METHOD_POST == $this->_method &&
- (!empty($this->_postData) || !empty($this->_postFiles))) {
+ } elseif (HTTP_REQUEST_METHOD_POST == $this->_method
+ && (!empty($this->_postData) || !empty($this->_postFiles))) {
// "normal" POST request
if (!isset($boundary)) {
$postdata = implode('&', array_map(
@@ -1100,8 +1100,8 @@ public function attach(&$listener)
*/
public function detach(&$listener)
{
- if (!is_a($listener, 'HTTP_Request_Listener') ||
- !isset($this->_listeners[$listener->getId()])) {
+ if (!is_a($listener, 'HTTP_Request_Listener')
+ || !isset($this->_listeners[$listener->getId()])) {
return false;
}
unset($this->_listeners[$listener->getId()]);
@@ -1231,9 +1231,9 @@ public function __construct(&$sock, &$listeners)
* @param bool Whether the response can actually have a message-body.
* Will be set to false for HEAD requests.
*
- * @throws PEAR_Error
- *
* @return mixed true on success, PEAR_Error in case of malformed response
+ *
+ * @throws PEAR_Error
*/
public function process($saveBody = true, $canHaveBody = true)
{
@@ -1259,15 +1259,15 @@ public function process($saveBody = true, $canHaveBody = true)
// 3. ... If a message is received with both a
// Transfer-Encoding header field and a Content-Length header field,
// the latter MUST be ignored.
- $canHaveBody = $canHaveBody && $this->_code >= 200 &&
- $this->_code != 204 && $this->_code != 304;
+ $canHaveBody = $canHaveBody && $this->_code >= 200
+ && $this->_code != 204 && $this->_code != 304;
// If response body is present, read it and decode
$chunked = isset($this->_headers['transfer-encoding']) && ('chunked' == $this->_headers['transfer-encoding']);
$gzipped = isset($this->_headers['content-encoding']) && ('gzip' == $this->_headers['content-encoding']);
$hasBody = false;
- if ($canHaveBody && ($chunked || !isset($this->_headers['content-length']) ||
- 0 != $this->_headers['content-length'])) {
+ if ($canHaveBody && ($chunked || !isset($this->_headers['content-length'])
+ || 0 != $this->_headers['content-length'])) {
if ($chunked || !isset($this->_headers['content-length'])) {
$this->_toRead = null;
} else {
@@ -1318,7 +1318,7 @@ public function process($saveBody = true, $canHaveBody = true)
*/
public function _processHeader($header)
{
- if (false === strpos($header, ':')) {
+ if (!str_contains($header, ':')) {
return;
}
list($headername, $headervalue) = explode(':', $header, 2);
@@ -1364,7 +1364,7 @@ public function _parseCookie($headervalue)
$cookie['value'] = trim(substr($elements[0], $pos + 1));
for ($i = 1; $i < count($elements); $i++) {
- if (false === strpos($elements[$i], '=')) {
+ if (!str_contains($elements[$i], '=')) {
$elName = trim($elements[$i]);
$elValue = null;
} else {
diff --git a/data/module/HTTP/Request/Listener.php b/data/module/HTTP/Request/Listener.php
index ce21a4630a..b6ec46c90d 100644
--- a/data/module/HTTP/Request/Listener.php
+++ b/data/module/HTTP/Request/Listener.php
@@ -90,6 +90,7 @@ public function getId()
* @param object an object the listener is attached to
* @param string Event name
* @param mixed Additional data
+ *
* @abstract
*/
public function update(&$subject, $event, $data = null)
diff --git a/data/module/Net/SMTP.php b/data/module/Net/SMTP.php
deleted file mode 100644
index cc043618c6..0000000000
--- a/data/module/Net/SMTP.php
+++ /dev/null
@@ -1,1210 +0,0 @@
- |
-// | Jon Parise
- * timed_out (bool) - The socket timed out waiting for data
- * blocked (bool) - The socket was blocked
- * eof (bool) - Indicates EOF event
- * unread_bytes (int) - Number of bytes left in the socket buffer
- *
プラグイン仕様書の記述方法
'); } @@ -19,7 +19,7 @@ public function prefilterTransform(&$source, LC_Page_Ex $objPage, $filename) break; case DEVICE_TYPE_ADMIN: default: - } + } $source = $objTransform->getHTML(); } } diff --git a/tests/class/helper/SC_Helper_Address/SC_Helper_Address_TestBase.php b/tests/class/helper/SC_Helper_Address/SC_Helper_Address_TestBase.php index 01bde11e48..bd711ebe7b 100644 --- a/tests/class/helper/SC_Helper_Address/SC_Helper_Address_TestBase.php +++ b/tests/class/helper/SC_Helper_Address/SC_Helper_Address_TestBase.php @@ -20,7 +20,7 @@ protected function tearDown(): void */ protected function setUpAddress() { - $objQuery = &SC_Query_Ex::getSingletonInstance(); + $objQuery = SC_Query_Ex::getSingletonInstance(); // シーケンス初期化 $kiyaku = [ @@ -42,7 +42,7 @@ protected function setUpAddress() 'fax01' => '111', 'fax02' => '1111', 'fax03' => '1111', - ], + ], [ 'other_deliv_id' => '1001', 'customer_id' => '1', @@ -61,8 +61,8 @@ protected function setUpAddress() 'fax01' => '111', 'fax02' => '1111', 'fax03' => '1111', - ], - ]; + ], + ]; $this->objQuery->delete('dtb_other_deliv'); foreach ($kiyaku as $key => $item) { diff --git a/tests/class/helper/SC_Helper_Address/SC_Helper_Address_deleteAddressTest.php b/tests/class/helper/SC_Helper_Address/SC_Helper_Address_deleteAddressTest.php index 49c5783e3d..b8b2de74c4 100644 --- a/tests/class/helper/SC_Helper_Address/SC_Helper_Address_deleteAddressTest.php +++ b/tests/class/helper/SC_Helper_Address/SC_Helper_Address_deleteAddressTest.php @@ -25,7 +25,7 @@ public function testdeleteAddressTest会員の登録配送先を削除する() $customer_id = 1; $this->expected = null; $this->objAddress->deleteAddress($other_deliv_id, $customer_id); - $objQuery = &SC_Query_Ex::getSingletonInstance(); + $objQuery = SC_Query_Ex::getSingletonInstance(); $select = '*'; $from = 'dtb_other_deliv'; $where = 'other_deliv_id = ? AND customer_id = ?'; diff --git a/tests/class/helper/SC_Helper_Address/SC_Helper_Address_getAddressTest.php b/tests/class/helper/SC_Helper_Address/SC_Helper_Address_getAddressTest.php index e3ceade30f..713069045b 100644 --- a/tests/class/helper/SC_Helper_Address/SC_Helper_Address_getAddressTest.php +++ b/tests/class/helper/SC_Helper_Address/SC_Helper_Address_getAddressTest.php @@ -45,27 +45,27 @@ public function testgetAddressTest会員の登録配送先が該当テーブル $other_deliv_id = '1001'; $customer_id = 1; $this->expected = [ - 'other_deliv_id' => '1001', - 'customer_id' => '1', - 'name01' => 'テスト', - 'name02' => 'に', - 'kana01' => 'テスト', - 'kana02' => 'ニ', - 'zip01' => '222', - 'zip02' => '2222', - 'pref' => '2', - 'addr01' => 'テスト1', - 'addr02' => 'テスト2', - 'tel01' => '000', - 'tel02' => '0000', - 'tel03' => '0000', - 'fax01' => '111', - 'fax02' => '1111', - 'fax03' => '1111', - 'country_id' => null, - 'company_name' => null, - 'zipcode' => null, - ]; + 'other_deliv_id' => '1001', + 'customer_id' => '1', + 'name01' => 'テスト', + 'name02' => 'に', + 'kana01' => 'テスト', + 'kana02' => 'ニ', + 'zip01' => '222', + 'zip02' => '2222', + 'pref' => '2', + 'addr01' => 'テスト1', + 'addr02' => 'テスト2', + 'tel01' => '000', + 'tel02' => '0000', + 'tel03' => '0000', + 'fax01' => '111', + 'fax02' => '1111', + 'fax03' => '1111', + 'country_id' => null, + 'company_name' => null, + 'zipcode' => null, + ]; $this->actual = $this->objAddress->getAddress($other_deliv_id, $customer_id); $this->verify('登録配送先取得'); diff --git a/tests/class/helper/SC_Helper_Address/SC_Helper_Address_getListTest.php b/tests/class/helper/SC_Helper_Address/SC_Helper_Address_getListTest.php index 1efba72da7..2366608579 100644 --- a/tests/class/helper/SC_Helper_Address/SC_Helper_Address_getListTest.php +++ b/tests/class/helper/SC_Helper_Address/SC_Helper_Address_getListTest.php @@ -44,8 +44,8 @@ public function testgetListTest会員が該当テーブルに存在するかつs 'country_id' => null, 'company_name' => null, 'zipcode' => null, - ], - ]; + ], + ]; $this->actual = $this->objAddress->getList($customer_id, $startno); $this->verify('配送先一覧取得'); @@ -56,7 +56,7 @@ public function testgetListTest会員が該当テーブルに存在する場合 $this->setUpAddress(); $customer_id = '1'; $this->expected = [ - [ + [ 'other_deliv_id' => '1001', 'customer_id' => '1', 'name01' => 'テスト', @@ -77,7 +77,7 @@ public function testgetListTest会員が該当テーブルに存在する場合 'country_id' => null, 'company_name' => null, 'zipcode' => null, - ], + ], [ 'other_deliv_id' => '1000', 'customer_id' => '1', @@ -99,8 +99,8 @@ public function testgetListTest会員が該当テーブルに存在する場合 'country_id' => null, 'company_name' => null, 'zipcode' => null, - ], - ]; + ], + ]; $this->actual = $this->objAddress->getList($customer_id); $this->verify('配送先一覧取得'); diff --git a/tests/class/helper/SC_Helper_Address/SC_Helper_Address_registAddressTest.php b/tests/class/helper/SC_Helper_Address/SC_Helper_Address_registAddressTest.php index 50a2d8f4cc..800fb41e7c 100644 --- a/tests/class/helper/SC_Helper_Address/SC_Helper_Address_registAddressTest.php +++ b/tests/class/helper/SC_Helper_Address/SC_Helper_Address_registAddressTest.php @@ -22,7 +22,7 @@ protected function tearDown(): void /* public function testregistAddressTest_顧客idが無い場合_システムエラーを返す() { - $objQuery =& SC_Query_Ex::getSingletonInstance(); + $objQuery = SC_Query_Ex::getSingletonInstance(); $this->setUpAddress(); //$this->expected = "1"; $this->objAddress->registAddress(null); @@ -56,7 +56,7 @@ public function testregistAddressTest_会員の登録配送先を追加する() 'fax03' => '1114', 'country_id' => null ); - $objQuery =& SC_Query_Ex::getSingletonInstance(); + $objQuery = SC_Query_Ex::getSingletonInstance(); $this->expected = '1002'; $this->objAddress->registAddress($arrSql); $col = 'other_deliv_id'; @@ -96,7 +96,7 @@ public function testregistAddressTest会員の登録配送先を更新する() 'company_name' => null, 'zipcode' => null, ]; - $objQuery = &SC_Query_Ex::getSingletonInstance(); + $objQuery = SC_Query_Ex::getSingletonInstance(); $this->objAddress->registAddress($arrSql); $this->expected = $arrSql; diff --git a/tests/class/helper/SC_Helper_DB/SC_Helper_DB_TestBase.php b/tests/class/helper/SC_Helper_DB/SC_Helper_DB_TestBase.php index a0e580e133..8be6678a82 100644 --- a/tests/class/helper/SC_Helper_DB/SC_Helper_DB_TestBase.php +++ b/tests/class/helper/SC_Helper_DB/SC_Helper_DB_TestBase.php @@ -49,28 +49,28 @@ protected function setUpNews() { $news = [ [ - 'update_date' => '2000-01-01 00:00:00', - 'news_id' => '1', - 'news_title' => 'ニュース情報01', - 'rank' => '1', - 'creator_id' => '1', - 'del_flg' => '0', + 'update_date' => '2000-01-01 00:00:00', + 'news_id' => '1', + 'news_title' => 'ニュース情報01', + 'rank' => '1', + 'creator_id' => '1', + 'del_flg' => '0', ], [ - 'update_date' => '2000-01-01 00:00:00', - 'news_id' => '2', - 'news_title' => 'ニュース情報02', - 'rank' => '2', - 'creator_id' => '1', - 'del_flg' => '0', + 'update_date' => '2000-01-01 00:00:00', + 'news_id' => '2', + 'news_title' => 'ニュース情報02', + 'rank' => '2', + 'creator_id' => '1', + 'del_flg' => '0', ], [ - 'update_date' => '2000-01-01 00:00:00', - 'news_id' => '3', - 'news_title' => 'ニュース情報03', - 'rank' => '3', - 'creator_id' => '1', - 'del_flg' => '0', + 'update_date' => '2000-01-01 00:00:00', + 'news_id' => '3', + 'news_title' => 'ニュース情報03', + 'rank' => '3', + 'creator_id' => '1', + 'del_flg' => '0', ], ]; diff --git a/tests/class/helper/SC_Helper_DB/SC_Helper_DB_sfGetAddPointTest.php b/tests/class/helper/SC_Helper_DB/SC_Helper_DB_sfGetAddPointTest.php index 53197f8746..96c65149e0 100644 --- a/tests/class/helper/SC_Helper_DB/SC_Helper_DB_sfGetAddPointTest.php +++ b/tests/class/helper/SC_Helper_DB/SC_Helper_DB_sfGetAddPointTest.php @@ -13,6 +13,7 @@ protected function setUp(): void /** * @runInSeparateProcess + * * @preserveGlobalState disabled */ public function testSfGetAddPoint() @@ -28,6 +29,7 @@ public function testSfGetAddPoint() /** * @runInSeparateProcess + * * @preserveGlobalState disabled */ public function testSfGetAddPointWithMinus() diff --git a/tests/class/helper/SC_Helper_DB/SC_Helper_DB_sfGetBasisCountTest.php b/tests/class/helper/SC_Helper_DB/SC_Helper_DB_sfGetBasisCountTest.php index 787aa760ab..634835e670 100644 --- a/tests/class/helper/SC_Helper_DB/SC_Helper_DB_sfGetBasisCountTest.php +++ b/tests/class/helper/SC_Helper_DB/SC_Helper_DB_sfGetBasisCountTest.php @@ -59,7 +59,7 @@ public function testSfGetBasisCount_baseinfoのデータが2行の場合_2を返 $baseinfo = [ 'id' => 2, 'update_date' => 'CURRENT_TIMESTAMP', - ]; + ]; $this->objQuery->insert('dtb_baseinfo', $baseinfo); $this->expected = 2; $this->actual = $this->helper->sfGetBasisCount(); diff --git a/tests/class/helper/SC_Helper_Kiyaku/SC_Helper_Kiyaku_TestBase.php b/tests/class/helper/SC_Helper_Kiyaku/SC_Helper_Kiyaku_TestBase.php index 3845d6c618..12dcfa8efd 100755 --- a/tests/class/helper/SC_Helper_Kiyaku/SC_Helper_Kiyaku_TestBase.php +++ b/tests/class/helper/SC_Helper_Kiyaku/SC_Helper_Kiyaku_TestBase.php @@ -20,7 +20,7 @@ protected function tearDown(): void */ protected function setUpKiyaku() { - $objQuery = &SC_Query_Ex::getSingletonInstance(); + $objQuery = SC_Query_Ex::getSingletonInstance(); $kiyaku = [ [ @@ -32,7 +32,7 @@ protected function setUpKiyaku() 'create_date' => '2000-01-01 00:00:00', 'update_date' => '2000-01-01 00:00:00', 'del_flg' => '0', - ], + ], [ 'kiyaku_id' => '1001', 'kiyaku_title' => 'test2', @@ -42,7 +42,7 @@ protected function setUpKiyaku() 'create_date' => '2000-01-01 00:00:00', 'update_date' => '2000-01-01 00:00:00', 'del_flg' => '0', - ], + ], [ 'kiyaku_id' => '1002', 'kiyaku_title' => 'test3', @@ -52,8 +52,8 @@ protected function setUpKiyaku() 'create_date' => '2000-01-01 00:00:00', 'update_date' => '2000-01-01 00:00:00', 'del_flg' => '1', - ], - ]; + ], + ]; $this->objQuery->delete('dtb_kiyaku'); foreach ($kiyaku as $key => $item) { diff --git a/tests/class/helper/SC_Helper_Kiyaku/SC_Helper_Kiyaku_deleteKiyakuTest.php b/tests/class/helper/SC_Helper_Kiyaku/SC_Helper_Kiyaku_deleteKiyakuTest.php index 1bb11dc65b..8f6972d714 100644 --- a/tests/class/helper/SC_Helper_Kiyaku/SC_Helper_Kiyaku_deleteKiyakuTest.php +++ b/tests/class/helper/SC_Helper_Kiyaku/SC_Helper_Kiyaku_deleteKiyakuTest.php @@ -20,7 +20,7 @@ protected function tearDown(): void public function testdeleteKiyakuTest削除ができた場合DelFlgの1を返す() { - $objQuery = &SC_Query_Ex::getSingletonInstance(); + $objQuery = SC_Query_Ex::getSingletonInstance(); $this->setUpKiyaku(); $kiyaku_id = 1001; diff --git a/tests/class/helper/SC_Helper_Kiyaku/SC_Helper_Kiyaku_getKiyakuTest.php b/tests/class/helper/SC_Helper_Kiyaku/SC_Helper_Kiyaku_getKiyakuTest.php index 728d7c3095..277cf20138 100644 --- a/tests/class/helper/SC_Helper_Kiyaku/SC_Helper_Kiyaku_getKiyakuTest.php +++ b/tests/class/helper/SC_Helper_Kiyaku/SC_Helper_Kiyaku_getKiyakuTest.php @@ -20,7 +20,7 @@ protected function tearDown(): void public function testgetKiyakuTest規約情報を取得できた場合規約のarrayを返す() { - $objQuery = &SC_Query_Ex::getSingletonInstance(); + $objQuery = SC_Query_Ex::getSingletonInstance(); $this->setUpKiyaku(); $has_deleted = false; $kiyaku_id = 1000; @@ -34,7 +34,7 @@ public function testgetKiyakuTest規約情報を取得できた場合規約のar 'create_date' => '2000-01-01 00:00:00', 'update_date' => '2000-01-01 00:00:00', 'del_flg' => '0', - ]; + ]; $this->actual = $this->objKiyaku->getKiyaku($kiyaku_id, $has_deleted); $this->verify('規約詳細取得'); @@ -42,7 +42,7 @@ public function testgetKiyakuTest規約情報を取得できた場合規約のar public function testgetKiyakuTest規約情報を規約idから取得する際削除された規約を指定した場合Nullを返す() { - $objQuery = &SC_Query_Ex::getSingletonInstance(); + $objQuery = SC_Query_Ex::getSingletonInstance(); $this->setUpKiyaku(); $has_deleted = false; $kiyaku_id = 1002; @@ -55,21 +55,21 @@ public function testgetKiyakuTest規約情報を規約idから取得する際削 public function testgetKiyakuTest削除された情報を含む規約情報を規約idから取得する際削除された規約を指定した場合Nullを返す() { - $objQuery = &SC_Query_Ex::getSingletonInstance(); + $objQuery = SC_Query_Ex::getSingletonInstance(); $this->setUpKiyaku(); $has_deleted = true; $kiyaku_id = 1002; // 期待値 $this->expected = [ - 'kiyaku_id' => '1002', - 'kiyaku_title' => 'test3', - 'kiyaku_text' => 'test_text', - 'rank' => '10', - 'creator_id' => '0', - 'create_date' => '2000-01-01 00:00:00', - 'update_date' => '2000-01-01 00:00:00', - 'del_flg' => '1', - ]; + 'kiyaku_id' => '1002', + 'kiyaku_title' => 'test3', + 'kiyaku_text' => 'test_text', + 'rank' => '10', + 'creator_id' => '0', + 'create_date' => '2000-01-01 00:00:00', + 'update_date' => '2000-01-01 00:00:00', + 'del_flg' => '1', + ]; $this->actual = $this->objKiyaku->getKiyaku($kiyaku_id, $has_deleted); $this->verify('規約詳細取得'); diff --git a/tests/class/helper/SC_Helper_Kiyaku/SC_Helper_Kiyaku_getListTest.php b/tests/class/helper/SC_Helper_Kiyaku/SC_Helper_Kiyaku_getListTest.php index a493ce3af2..a86dd4d7d2 100644 --- a/tests/class/helper/SC_Helper_Kiyaku/SC_Helper_Kiyaku_getListTest.php +++ b/tests/class/helper/SC_Helper_Kiyaku/SC_Helper_Kiyaku_getListTest.php @@ -20,7 +20,7 @@ protected function tearDown(): void public function testgetListTest削除した商品も含んだ一覧を取得できた場合一覧のarrayを返す() { - $objQuery = &SC_Query_Ex::getSingletonInstance(); + $objQuery = SC_Query_Ex::getSingletonInstance(); $this->setUpKiyaku(); $has_deleted = true; // 期待値 @@ -29,18 +29,18 @@ public function testgetListTest削除した商品も含んだ一覧を取得で 'kiyaku_id' => '1000', 'kiyaku_title' => 'test1', 'kiyaku_text' => 'test_text', - ], + ], [ 'kiyaku_id' => '1001', 'kiyaku_title' => 'test2', 'kiyaku_text' => 'test_text2', - ], + ], [ 'kiyaku_id' => '1002', 'kiyaku_title' => 'test3', 'kiyaku_text' => 'test_text', - ], - ]; + ], + ]; $this->actual = $this->objKiyaku->getList($has_deleted); $this->verify('規約一覧取得'); @@ -48,7 +48,7 @@ public function testgetListTest削除した商品も含んだ一覧を取得で public function testgetListTest一覧を取得できた場合削除した商品は取得しない一覧のarrayを返す() { - $objQuery = &SC_Query_Ex::getSingletonInstance(); + $objQuery = SC_Query_Ex::getSingletonInstance(); $this->setUpKiyaku(); $has_deleted = false; // 期待値 @@ -57,13 +57,13 @@ public function testgetListTest一覧を取得できた場合削除した商品 'kiyaku_id' => '1000', 'kiyaku_title' => 'test1', 'kiyaku_text' => 'test_text', - ], + ], [ 'kiyaku_id' => '1001', 'kiyaku_title' => 'test2', 'kiyaku_text' => 'test_text2', - ], - ]; + ], + ]; $this->actual = $this->objKiyaku->getList($has_deleted); $this->verify('規約一覧取得'); diff --git a/tests/class/helper/SC_Helper_Kiyaku/SC_Helper_Kiyaku_rankDownTest.php b/tests/class/helper/SC_Helper_Kiyaku/SC_Helper_Kiyaku_rankDownTest.php index dcaf5e18a6..3b2ff94065 100644 --- a/tests/class/helper/SC_Helper_Kiyaku/SC_Helper_Kiyaku_rankDownTest.php +++ b/tests/class/helper/SC_Helper_Kiyaku/SC_Helper_Kiyaku_rankDownTest.php @@ -20,7 +20,7 @@ protected function tearDown(): void public function testrankDownTestランクダウンができた場合ランクを返す() { - $objQuery = &SC_Query_Ex::getSingletonInstance(); + $objQuery = SC_Query_Ex::getSingletonInstance(); $this->setUpKiyaku(); $kiyaku_id = 1000; diff --git a/tests/class/helper/SC_Helper_Kiyaku/SC_Helper_Kiyaku_rankUpTest.php b/tests/class/helper/SC_Helper_Kiyaku/SC_Helper_Kiyaku_rankUpTest.php index 4011159452..2504fef7c4 100644 --- a/tests/class/helper/SC_Helper_Kiyaku/SC_Helper_Kiyaku_rankUpTest.php +++ b/tests/class/helper/SC_Helper_Kiyaku/SC_Helper_Kiyaku_rankUpTest.php @@ -20,7 +20,7 @@ protected function tearDown(): void public function testrankUpTestランクアップができた場合ランクを返す() { - $objQuery = &SC_Query_Ex::getSingletonInstance(); + $objQuery = SC_Query_Ex::getSingletonInstance(); $this->setUpKiyaku(); $kiyaku_id = 1001; diff --git a/tests/class/helper/SC_Helper_Kiyaku/SC_Helper_Kiyaku_saveKiyakuTest.php b/tests/class/helper/SC_Helper_Kiyaku/SC_Helper_Kiyaku_saveKiyakuTest.php index c798b15f8c..daf8acaa31 100644 --- a/tests/class/helper/SC_Helper_Kiyaku/SC_Helper_Kiyaku_saveKiyakuTest.php +++ b/tests/class/helper/SC_Helper_Kiyaku/SC_Helper_Kiyaku_saveKiyakuTest.php @@ -24,7 +24,7 @@ public function testsaveKiyakuTest_新規で規約を登録する場合_1003を if(DB_TYPE != 'pgsql') { //postgresqlだとどうしてもDBエラーになるのでとりいそぎ回避 - $objQuery =& SC_Query_Ex::getSingletonInstance(); + $objQuery = SC_Query_Ex::getSingletonInstance(); $this->setUpKiyaku(); $this->expected = '1003'; @@ -54,7 +54,7 @@ public function testsaveKiyakuTest_規約を更新する場合_1001を返す() { if(DB_TYPE != 'pgsql') { //postgresqlだとどうしてもDBエラーになるのでとりいそぎ回避 - $objQuery =& SC_Query_Ex::getSingletonInstance(); + $objQuery = SC_Query_Ex::getSingletonInstance(); $this->setUpKiyaku(); $sqlval = array( 'kiyaku_id' => '1001', diff --git a/tests/class/helper/SC_Helper_News/SC_Helper_News_TestBase.php b/tests/class/helper/SC_Helper_News/SC_Helper_News_TestBase.php index 6bab18076f..068526078a 100644 --- a/tests/class/helper/SC_Helper_News/SC_Helper_News_TestBase.php +++ b/tests/class/helper/SC_Helper_News/SC_Helper_News_TestBase.php @@ -48,37 +48,37 @@ protected function tearDown(): void protected function setUpNews() { $news = [ - [ - 'update_date' => '2000-01-01 00:00:00', - 'news_id' => '1001', - 'news_title' => 'ニュース情報01', - 'rank' => '1', - 'creator_id' => '1', - 'del_flg' => '0', + [ + 'update_date' => '2000-01-01 00:00:00', + 'news_id' => '1001', + 'news_title' => 'ニュース情報01', + 'rank' => '1', + 'creator_id' => '1', + 'del_flg' => '0', ], - [ - 'update_date' => '2000-01-01 00:00:00', - 'news_id' => '1002', - 'news_title' => 'ニュース情報02', - 'rank' => '2', - 'creator_id' => '1', - 'del_flg' => '0', + [ + 'update_date' => '2000-01-01 00:00:00', + 'news_id' => '1002', + 'news_title' => 'ニュース情報02', + 'rank' => '2', + 'creator_id' => '1', + 'del_flg' => '0', ], - [ - 'update_date' => '2000-01-01 00:00:00', - 'news_id' => '1003', - 'news_title' => 'ニュース情報03', - 'rank' => '3', - 'creator_id' => '1', - 'del_flg' => '1', + [ + 'update_date' => '2000-01-01 00:00:00', + 'news_id' => '1003', + 'news_title' => 'ニュース情報03', + 'rank' => '3', + 'creator_id' => '1', + 'del_flg' => '1', ], - [ - 'update_date' => '2000-01-01 00:00:00', - 'news_id' => '1004', - 'news_title' => 'ニュース情報04', - 'rank' => '4', - 'creator_id' => '1', - 'del_flg' => '0', + [ + 'update_date' => '2000-01-01 00:00:00', + 'news_id' => '1004', + 'news_title' => 'ニュース情報04', + 'rank' => '4', + 'creator_id' => '1', + 'del_flg' => '0', ], ]; diff --git a/tests/class/helper/SC_Helper_News/SC_Helper_News_deleteNewsTest.php b/tests/class/helper/SC_Helper_News/SC_Helper_News_deleteNewsTest.php index 4bd5450554..89a9b22b6a 100644 --- a/tests/class/helper/SC_Helper_News/SC_Helper_News_deleteNewsTest.php +++ b/tests/class/helper/SC_Helper_News/SC_Helper_News_deleteNewsTest.php @@ -20,7 +20,7 @@ protected function tearDown(): void public function testDeleteNewsTestニュースIDを指定した場合対象のニュース情報が削除される() { - $objQuery = &SC_Query_Ex::getSingletonInstance(); + $objQuery = SC_Query_Ex::getSingletonInstance(); $this->setUpNews(); $news_id = 1002; diff --git a/tests/class/helper/SC_Helper_News/SC_Helper_News_getListTest.php b/tests/class/helper/SC_Helper_News/SC_Helper_News_getListTest.php index 0b67af39db..d775a8e2eb 100644 --- a/tests/class/helper/SC_Helper_News/SC_Helper_News_getListTest.php +++ b/tests/class/helper/SC_Helper_News/SC_Helper_News_getListTest.php @@ -20,42 +20,42 @@ protected function tearDown(): void public function testGetList削除されたニュースも含む場合全てのニュース一覧が取得できる() { - $objQuery = &SC_Query_Ex::getSingletonInstance(); + $objQuery = SC_Query_Ex::getSingletonInstance(); $this->setUpNews(); $dispNumber = 0; $pageNumber = 0; $has_deleted = true; $this->expected = [ - [ - 'update_date' => '2000-01-01 00:00:00', - 'news_id' => '1004', - 'news_title' => 'ニュース情報04', - 'creator_id' => '1', - 'del_flg' => '0', + [ + 'update_date' => '2000-01-01 00:00:00', + 'news_id' => '1004', + 'news_title' => 'ニュース情報04', + 'creator_id' => '1', + 'del_flg' => '0', ], - [ - 'update_date' => '2000-01-01 00:00:00', - 'news_id' => '1003', - 'news_title' => 'ニュース情報03', - 'creator_id' => '1', - 'del_flg' => '1', + [ + 'update_date' => '2000-01-01 00:00:00', + 'news_id' => '1003', + 'news_title' => 'ニュース情報03', + 'creator_id' => '1', + 'del_flg' => '1', ], - [ - 'update_date' => '2000-01-01 00:00:00', - 'news_id' => '1002', - 'news_title' => 'ニュース情報02', - 'creator_id' => '1', - 'del_flg' => '0', + [ + 'update_date' => '2000-01-01 00:00:00', + 'news_id' => '1002', + 'news_title' => 'ニュース情報02', + 'creator_id' => '1', + 'del_flg' => '0', ], - [ - 'update_date' => '2000-01-01 00:00:00', - 'news_id' => '1001', - 'news_title' => 'ニュース情報01', - 'creator_id' => '1', - 'del_flg' => '0', + [ + 'update_date' => '2000-01-01 00:00:00', + 'news_id' => '1001', + 'news_title' => 'ニュース情報01', + 'creator_id' => '1', + 'del_flg' => '0', ], - ]; + ]; $result = $this->objNews->getList($dispNumber, $pageNumber, $has_deleted); foreach ($result as $value) { $this->actual[] = Test_Utils::mapArray($value, ['update_date', 'news_id', 'news_title', 'creator_id', 'del_flg']); @@ -66,35 +66,35 @@ public function testGetList削除されたニュースも含む場合全ての public function testGetList削除されたニュースは含まない場合削除されていないニュース一覧が取得できる() { - $objQuery = &SC_Query_Ex::getSingletonInstance(); + $objQuery = SC_Query_Ex::getSingletonInstance(); $this->setUpNews(); $dispNumber = 0; $pageNumber = 0; $has_deleted = false; $this->expected = [ - [ - 'update_date' => '2000-01-01 00:00:00', - 'news_id' => '1004', - 'news_title' => 'ニュース情報04', - 'creator_id' => '1', - 'del_flg' => '0', + [ + 'update_date' => '2000-01-01 00:00:00', + 'news_id' => '1004', + 'news_title' => 'ニュース情報04', + 'creator_id' => '1', + 'del_flg' => '0', ], - [ - 'update_date' => '2000-01-01 00:00:00', - 'news_id' => '1002', - 'news_title' => 'ニュース情報02', - 'creator_id' => '1', - 'del_flg' => '0', + [ + 'update_date' => '2000-01-01 00:00:00', + 'news_id' => '1002', + 'news_title' => 'ニュース情報02', + 'creator_id' => '1', + 'del_flg' => '0', ], - [ - 'update_date' => '2000-01-01 00:00:00', - 'news_id' => '1001', - 'news_title' => 'ニュース情報01', - 'creator_id' => '1', - 'del_flg' => '0', + [ + 'update_date' => '2000-01-01 00:00:00', + 'news_id' => '1001', + 'news_title' => 'ニュース情報01', + 'creator_id' => '1', + 'del_flg' => '0', ], - ]; + ]; $result = $this->objNews->getList($dispNumber, $pageNumber, $has_deleted); foreach ($result as $value) { @@ -106,18 +106,18 @@ public function testGetList削除されたニュースは含まない場合削 public function testGetList表示件数1かつページ番号3の場合対象のニュースが取得できる() { - $objQuery = &SC_Query_Ex::getSingletonInstance(); + $objQuery = SC_Query_Ex::getSingletonInstance(); $this->setUpNews(); $dispNumber = 1; $pageNumber = 3; $has_deleted = false; $this->expected = [ - 'update_date' => '2000-01-01 00:00:00', - 'news_id' => '1001', - 'news_title' => 'ニュース情報01', - 'creator_id' => '1', - 'del_flg' => '0', + 'update_date' => '2000-01-01 00:00:00', + 'news_id' => '1001', + 'news_title' => 'ニュース情報01', + 'creator_id' => '1', + 'del_flg' => '0', ]; $result = $this->objNews->getList($dispNumber, $pageNumber, $has_deleted); @@ -128,18 +128,18 @@ public function testGetList表示件数1かつページ番号3の場合対象の public function testGetList表示件数1かつページ番号0の場合対象のニュースが取得できる() { - $objQuery = &SC_Query_Ex::getSingletonInstance(); + $objQuery = SC_Query_Ex::getSingletonInstance(); $this->setUpNews(); $dispNumber = 1; $pageNumber = 0; $has_deleted = false; $this->expected = [ - 'update_date' => '2000-01-01 00:00:00', - 'news_id' => '1004', - 'news_title' => 'ニュース情報04', - 'creator_id' => '1', - 'del_flg' => '0', + 'update_date' => '2000-01-01 00:00:00', + 'news_id' => '1004', + 'news_title' => 'ニュース情報04', + 'creator_id' => '1', + 'del_flg' => '0', ]; $result = $this->objNews->getList($dispNumber, $pageNumber, $has_deleted); diff --git a/tests/class/helper/SC_Helper_News/SC_Helper_News_getNewsTest.php b/tests/class/helper/SC_Helper_News/SC_Helper_News_getNewsTest.php index a630d1c7f5..1e9b202e3b 100644 --- a/tests/class/helper/SC_Helper_News/SC_Helper_News_getNewsTest.php +++ b/tests/class/helper/SC_Helper_News/SC_Helper_News_getNewsTest.php @@ -36,11 +36,11 @@ public function testGet存在するニュースIDを指定した場合対応す $news_id = '1001'; $this->expected = [ - 'update_date' => '2000-01-01 00:00:00', - 'news_id' => '1001', - 'news_title' => 'ニュース情報01', - 'creator_id' => '1', - 'del_flg' => '0', + 'update_date' => '2000-01-01 00:00:00', + 'news_id' => '1001', + 'news_title' => 'ニュース情報01', + 'creator_id' => '1', + 'del_flg' => '0', ]; $result = $this->objNews->getNews($news_id); diff --git a/tests/class/helper/SC_Helper_News/SC_Helper_News_moveRankTest.php b/tests/class/helper/SC_Helper_News/SC_Helper_News_moveRankTest.php index e10cb9b64b..b48232f26e 100644 --- a/tests/class/helper/SC_Helper_News/SC_Helper_News_moveRankTest.php +++ b/tests/class/helper/SC_Helper_News/SC_Helper_News_moveRankTest.php @@ -20,7 +20,7 @@ protected function tearDown(): void public function testMoveRankTestニュースIDと移動先ランクを指定した場合対象のランクが移動する() { - $objQuery = &SC_Query_Ex::getSingletonInstance(); + $objQuery = SC_Query_Ex::getSingletonInstance(); $this->setUpNews(); $news_id = 1001; $rank = 1; diff --git a/tests/class/helper/SC_Helper_News/SC_Helper_News_rankDownTest.php b/tests/class/helper/SC_Helper_News/SC_Helper_News_rankDownTest.php index 1e557b7d36..1ae36aecd2 100644 --- a/tests/class/helper/SC_Helper_News/SC_Helper_News_rankDownTest.php +++ b/tests/class/helper/SC_Helper_News/SC_Helper_News_rankDownTest.php @@ -20,7 +20,7 @@ protected function tearDown(): void public function testRankDownTestニュースIDを指定した場合対象のランクが1減少する() { - $objQuery = &SC_Query_Ex::getSingletonInstance(); + $objQuery = SC_Query_Ex::getSingletonInstance(); $this->setUpNews(); $news_id = 1003; diff --git a/tests/class/helper/SC_Helper_News/SC_Helper_News_rankUpTest.php b/tests/class/helper/SC_Helper_News/SC_Helper_News_rankUpTest.php index 67d2db3fc4..b0b1dc036c 100644 --- a/tests/class/helper/SC_Helper_News/SC_Helper_News_rankUpTest.php +++ b/tests/class/helper/SC_Helper_News/SC_Helper_News_rankUpTest.php @@ -20,7 +20,7 @@ protected function tearDown(): void public function testRankUpTestニュースIDを指定した場合対象のランクが1増加する() { - $objQuery = &SC_Query_Ex::getSingletonInstance(); + $objQuery = SC_Query_Ex::getSingletonInstance(); $this->setUpNews(); $news_id = 1002; diff --git a/tests/class/helper/SC_Helper_News/SC_Helper_News_saveNewsTest.php b/tests/class/helper/SC_Helper_News/SC_Helper_News_saveNewsTest.php index d92ca149a8..954a4dffc1 100644 --- a/tests/class/helper/SC_Helper_News/SC_Helper_News_saveNewsTest.php +++ b/tests/class/helper/SC_Helper_News/SC_Helper_News_saveNewsTest.php @@ -24,7 +24,7 @@ public function testSaveNewsTestNewsIdが空の場合新規登録される() $this->markTestSkipped('postgresqlだとどうしてもDBエラーになるのでスキップ'); } - $objQuery = &SC_Query_Ex::getSingletonInstance(); + $objQuery = SC_Query_Ex::getSingletonInstance(); $this->setUpNews(); $sqlval = [ @@ -48,7 +48,8 @@ public function testSaveNewsTestNewsIdが空の場合新規登録される() 'news_title, creator_id, del_flg', 'dtb_news', 'news_id = ?', - [$ret_id]); + [$ret_id] + ); $this->actual['content'] = $result[0]; $this->verify(); @@ -56,23 +57,23 @@ public function testSaveNewsTestNewsIdが空の場合新規登録される() public function testSaveNewsTestNewsIdが存在する場合対象のニュースが更新される() { - $objQuery = &SC_Query_Ex::getSingletonInstance(); + $objQuery = SC_Query_Ex::getSingletonInstance(); $this->setUpNews(); $sqlval = [ - 'news_id' => '1002', - 'news_title' => 'ニュース情報05更新', - 'creator_id' => '1', - 'del_flg' => '0', - ]; + 'news_id' => '1002', + 'news_title' => 'ニュース情報05更新', + 'creator_id' => '1', + 'del_flg' => '0', + ]; $this->expected['count'] = '4'; $this->expected['content'] = [ - 'news_id' => '1002', - 'news_title' => 'ニュース情報05更新', - 'creator_id' => '1', - 'del_flg' => '0', - ]; + 'news_id' => '1002', + 'news_title' => 'ニュース情報05更新', + 'creator_id' => '1', + 'del_flg' => '0', + ]; $ret_id = $this->objNews->saveNews($sqlval); @@ -81,7 +82,8 @@ public function testSaveNewsTestNewsIdが存在する場合対象のニュース 'news_id, news_title, creator_id, del_flg', 'dtb_news', 'news_id = ?', - [$ret_id]); + [$ret_id] + ); $this->actual['content'] = $result[0]; $this->verify(); diff --git a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_TestBase.php b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_TestBase.php index 1f8c90db38..e0ac78e25d 100644 --- a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_TestBase.php +++ b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_TestBase.php @@ -60,29 +60,29 @@ protected function setUpShipping($shipping) protected function getSingleShipping() { return [ - '00001' => [ - 'shipment_id' => '00001', - 'shipment_item' => '商品1', - 'shipping_pref' => '東京都', ], - ]; + '00001' => [ + 'shipment_id' => '00001', + 'shipment_item' => '商品1', + 'shipping_pref' => '東京都', ], + ]; } protected function getMultipleShipping() { return [ - '00001' => [ - 'shipment_id' => '00001', - 'shipment_item' => ['商品1'], - 'shipping_pref' => '東京都', ], - '00002' => [ - 'shipment_id' => '00002', - 'shipment_item' => ['商品2'], - 'shipping_pref' => '沖縄県', ], - '00003' => [ - 'shipment_id' => '00003', - 'shipment_item' => [], - 'shipping_pref' => '埼玉県', ], - ]; + '00001' => [ + 'shipment_id' => '00001', + 'shipment_item' => ['商品1'], + 'shipping_pref' => '東京都', ], + '00002' => [ + 'shipment_id' => '00002', + 'shipment_item' => ['商品2'], + 'shipping_pref' => '沖縄県', ], + '00003' => [ + 'shipment_id' => '00003', + 'shipment_item' => [], + 'shipping_pref' => '埼玉県', ], + ]; } /** @@ -91,28 +91,28 @@ protected function getMultipleShipping() protected function setUpShippingOnDb() { $shippings = [ - [ - 'update_date' => '2000-01-01 00:00:00', - 'shipping_id' => '1', - 'order_id' => '1001', - 'shipping_name01' => '配送情報01', - 'shipping_date' => '2012-01-12', - ], - [ - 'update_date' => '2000-01-01 00:00:00', - 'shipping_id' => '2', - 'order_id' => '2', - 'shipping_name01' => '配送情報02', - 'shipping_date' => '2011-10-01', - ], - [ - 'update_date' => '2000-01-01 00:00:00', - 'shipping_id' => '1002', - 'order_id' => '1002', - 'shipping_time' => '午後', - 'time_id' => '1', - ], - ]; + [ + 'update_date' => '2000-01-01 00:00:00', + 'shipping_id' => '1', + 'order_id' => '1001', + 'shipping_name01' => '配送情報01', + 'shipping_date' => '2012-01-12', + ], + [ + 'update_date' => '2000-01-01 00:00:00', + 'shipping_id' => '2', + 'order_id' => '2', + 'shipping_name01' => '配送情報02', + 'shipping_date' => '2011-10-01', + ], + [ + 'update_date' => '2000-01-01 00:00:00', + 'shipping_id' => '1002', + 'order_id' => '1002', + 'shipping_time' => '午後', + 'time_id' => '1', + ], + ]; $this->objQuery->delete('dtb_shipping'); foreach ($shippings as $key => $item) { @@ -126,24 +126,24 @@ protected function setUpShippingOnDb() protected function setUpOrder($customer_ids = [], $product_class_ids = []) { $orders = [ - [ - 'update_date' => '2000-01-01 00:00:00', - 'customer_id' => $customer_ids[0], - 'order_name01' => '受注情報01', - 'status' => '3', - 'payment_date' => '2032-12-31 01:20:30', // 日付が変わっても良いように、遠い未来に設定 - 'use_point' => '10', - 'add_point' => '20', - ], - [ - 'update_date' => '2000-01-01 00:00:00', - 'customer_id' => $customer_ids[1], - 'order_name01' => '受注情報02', - 'status' => '5', - 'use_point' => '10', - 'add_point' => '20', - ], - ]; + [ + 'update_date' => '2000-01-01 00:00:00', + 'customer_id' => $customer_ids[0], + 'order_name01' => '受注情報01', + 'status' => '3', + 'payment_date' => '2032-12-31 01:20:30', // 日付が変わっても良いように、遠い未来に設定 + 'use_point' => '10', + 'add_point' => '20', + ], + [ + 'update_date' => '2000-01-01 00:00:00', + 'customer_id' => $customer_ids[1], + 'order_name01' => '受注情報02', + 'status' => '5', + 'use_point' => '10', + 'add_point' => '20', + ], + ]; $this->objQuery->delete('dtb_order'); @@ -173,8 +173,8 @@ protected function setUpCustomer() $this->objQuery->delete('dtb_customer'); return [ - $this->objGenerator->createCustomer(null, ['point' => 100]), - $this->objGenerator->createCustomer(null, ['point' => 200]), - ]; + $this->objGenerator->createCustomer(null, ['point' => 100]), + $this->objGenerator->createCustomer(null, ['point' => 200]), + ]; } } diff --git a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_cancelOrderTest.php b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_cancelOrderTest.php index 963dc70bf7..151bb78c6e 100644 --- a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_cancelOrderTest.php +++ b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_cancelOrderTest.php @@ -67,22 +67,22 @@ public function testCancelOrderデフォルトの引数で呼び出した場合 }, $this->arrProductsClasses) ); $this->expected = [ - 'testResult' => [ - 'registerOrder' => [ - 'order_id' => '1001', - 'params' => [ - 'status' => ORDER_CANCEL, - ], - ], - 'getOrderDetail' => [ - 'order_id' => '1001', - ], - ], - 'productClass' => array_map(function ($productsClass) { - return ['stock' => $productsClass['stock']]; - }, $this->arrProductsClasses - ), - ]; + 'testResult' => [ + 'registerOrder' => [ + 'order_id' => '1001', + 'params' => [ + 'status' => ORDER_CANCEL, + ], + ], + 'getOrderDetail' => [ + 'order_id' => '1001', + ], + ], + 'productClass' => array_map(function ($productsClass) { + return ['stock' => $productsClass['stock']]; + }, $this->arrProductsClasses + ), + ]; $this->verify(); } @@ -102,22 +102,22 @@ public function testCancelOrderトランザクションが開始していない }, $this->arrProductsClasses) ); $this->expected = [ - 'testResult' => [ - 'registerOrder' => [ - 'order_id' => '1001', - 'params' => [ - 'status' => ORDER_NEW, - ], - ], - 'getOrderDetail' => [ - 'order_id' => '1001', - ], - ], - 'productClass' => array_map(function ($productsClass) { - return ['stock' => $productsClass['stock']]; - }, $this->arrProductsClasses - ), - ]; + 'testResult' => [ + 'registerOrder' => [ + 'order_id' => '1001', + 'params' => [ + 'status' => ORDER_NEW, + ], + ], + 'getOrderDetail' => [ + 'order_id' => '1001', + ], + ], + 'productClass' => array_map(function ($productsClass) { + return ['stock' => $productsClass['stock']]; + }, $this->arrProductsClasses + ), + ]; $this->verify(); } @@ -137,23 +137,23 @@ public function testCancelOrder削除フラグが立っている場合DB更新 }, $this->arrProductsClasses) ); $this->expected = [ - 'testResult' => [ - 'registerOrder' => [ - 'order_id' => '1001', - 'params' => [ - 'status' => ORDER_DELIV, - 'del_flg' => '1', - ], - ], - 'getOrderDetail' => [ - 'order_id' => '1001', - ], - ], - 'productClass' => array_map(function ($productsClass) { - return ['stock' => $productsClass['stock']]; - }, $this->arrProductsClasses - ), - ]; + 'testResult' => [ + 'registerOrder' => [ + 'order_id' => '1001', + 'params' => [ + 'status' => ORDER_DELIV, + 'del_flg' => '1', + ], + ], + 'getOrderDetail' => [ + 'order_id' => '1001', + ], + ], + 'productClass' => array_map(function ($productsClass) { + return ['stock' => $productsClass['stock']]; + }, $this->arrProductsClasses + ), + ]; $this->verify(); } @@ -166,26 +166,26 @@ class SC_Helper_Purchase_cancelOrderMock extends SC_Helper_Purchase public static function registerOrder($order_id, $params) { $_SESSION['testResult']['registerOrder'] = [ - 'order_id' => $order_id, - 'params' => $params, - ]; + 'order_id' => $order_id, + 'params' => $params, + ]; } public static function getOrderDetail($order_id, $has_order_status = true) { $_SESSION['testResult']['getOrderDetail'] = [ - 'order_id' => $order_id, - ]; + 'order_id' => $order_id, + ]; return [ - [ - 'product_class_id' => '1001', - 'quantity' => '5', - ], - [ - 'product_class_id' => '1002', - 'quantity' => '1', - ], - ]; + [ + 'product_class_id' => '1001', + 'quantity' => '5', + ], + [ + 'product_class_id' => '1002', + 'quantity' => '1', + ], + ]; } } diff --git a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_cleanupSessionTest.php b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_cleanupSessionTest.php index 6ac2ffc4c6..07fb099632 100644 --- a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_cleanupSessionTest.php +++ b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_cleanupSessionTest.php @@ -68,12 +68,12 @@ public function testCleanupSessionカートとセッションの配送情報が $helper->cleanupSession(1001, $cartSession, $customer, PRODUCT_TYPE_NORMAL); $this->expected = [ - 'cart_max_deleted' => 0, - 'cart_max_notdeleted' => 1, - 'uniqid' => '', - 'shipping' => null, - 'multiple_temp' => null, - ]; + 'cart_max_deleted' => 0, + 'cart_max_notdeleted' => 1, + 'uniqid' => '', + 'shipping' => null, + 'multiple_temp' => null, + ]; $this->actual['cart_max_deleted'] = $cartSession->getMax(PRODUCT_TYPE_NORMAL); $this->actual['cart_max_notdeleted'] = $cartSession->getMax(PRODUCT_TYPE_DOWNLOAD); diff --git a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_completeOrderTest.php b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_completeOrderTest.php index 2be95d5db5..a4be2e13d1 100644 --- a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_completeOrderTest.php +++ b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_completeOrderTest.php @@ -51,11 +51,11 @@ protected function setUp(): void $_SESSION['cartKey'] = '1'; $_SESSION['site'] = [ - 'pre_page' => 'pre', - 'now_page' => 'now', - 'regist_success' => true, - 'uniqid' => $this->order_temp_ids[0], - ]; + 'pre_page' => 'pre', + 'now_page' => 'now', + 'regist_success' => true, + 'uniqid' => $this->order_temp_ids[0], + ]; $this->helper = new SC_Helper_Purchase_completeOrderMock(); } @@ -73,32 +73,32 @@ public function testCompleteOrder顧客IDが指定されている場合購入日 $this->helper->completeOrder(ORDER_DELIV); $this->expected = [ - 'verifyChangeCart' => [ - 'uniqId' => $this->order_temp_ids[0], - ], - 'getOrderTemp' => [ - 'uniqId' => $this->order_temp_ids[0], - ], - 'registerOrderComplete' => [ - 'order_temp_id' => $this->order_temp_ids[0], - 'status' => ORDER_DELIV, - 'cartKey' => '1', - ], - 'registerShipmentItem' => [ - [ - 'order_id' => $this->order_ids[0], - 'shipping_id' => '00001', - 'shipment_item' => '商品1', - ], - ], - 'registerShipping' => [ - 'order_id' => $this->order_ids[0], - ], - 'cleanupSession' => [ - 'order_id' => $this->order_ids[0], - 'cartKey' => '1', - ], - ]; + 'verifyChangeCart' => [ + 'uniqId' => $this->order_temp_ids[0], + ], + 'getOrderTemp' => [ + 'uniqId' => $this->order_temp_ids[0], + ], + 'registerOrderComplete' => [ + 'order_temp_id' => $this->order_temp_ids[0], + 'status' => ORDER_DELIV, + 'cartKey' => '1', + ], + 'registerShipmentItem' => [ + [ + 'order_id' => $this->order_ids[0], + 'shipping_id' => '00001', + 'shipment_item' => '商品1', + ], + ], + 'registerShipping' => [ + 'order_id' => $this->order_ids[0], + ], + 'cleanupSession' => [ + 'order_id' => $this->order_ids[0], + 'cartKey' => '1', + ], + ]; $this->actual = $_SESSION['testResult']; $this->verify('適切なfunctionが呼ばれている'); $last_buy_date = $this->objQuery->get('last_buy_date', 'dtb_customer', 'customer_id = ?', $this->customer_ids[1]); @@ -110,32 +110,32 @@ public function testCompleteOrder顧客IDが指定されていない場合特に $this->helper->completeOrder(); // デフォルトのステータス(NEW) $this->expected = [ - 'verifyChangeCart' => [ - 'uniqId' => $this->order_temp_ids[0], - ], - 'getOrderTemp' => [ - 'uniqId' => $this->order_temp_ids[0], - ], - 'registerOrderComplete' => [ - 'order_temp_id' => $this->order_temp_ids[0], - 'status' => ORDER_NEW, - 'cartKey' => '1', - ], - 'registerShipmentItem' => [ - [ - 'order_id' => (string) $this->order_ids[0], - 'shipping_id' => '00001', - 'shipment_item' => '商品1', - ], - ], - 'registerShipping' => [ - 'order_id' => (string) $this->order_ids[0], - ], - 'cleanupSession' => [ - 'order_id' => (string) $this->order_ids[0], - 'cartKey' => '1', - ], - ]; + 'verifyChangeCart' => [ + 'uniqId' => $this->order_temp_ids[0], + ], + 'getOrderTemp' => [ + 'uniqId' => $this->order_temp_ids[0], + ], + 'registerOrderComplete' => [ + 'order_temp_id' => $this->order_temp_ids[0], + 'status' => ORDER_NEW, + 'cartKey' => '1', + ], + 'registerShipmentItem' => [ + [ + 'order_id' => (string) $this->order_ids[0], + 'shipping_id' => '00001', + 'shipment_item' => '商品1', + ], + ], + 'registerShipping' => [ + 'order_id' => (string) $this->order_ids[0], + ], + 'cleanupSession' => [ + 'order_id' => (string) $this->order_ids[0], + 'cartKey' => '1', + ], + ]; $this->actual = $_SESSION['testResult']; $this->verify('適切なfunctionが呼ばれている'); } @@ -160,10 +160,10 @@ public static function getOrderTemp($uniqId) public function registerOrderComplete($orderTemp, &$objCartSession, $cartKey) { $_SESSION['testResult']['registerOrderComplete'] = [ - 'order_temp_id' => $orderTemp['order_temp_id'], - 'status' => $orderTemp['status'], - 'cartKey' => $cartKey, - ]; + 'order_temp_id' => $orderTemp['order_temp_id'], + 'status' => $orderTemp['status'], + 'cartKey' => $cartKey, + ]; return parent::registerOrderComplete($orderTemp, $objCartSession, $cartKey); } @@ -171,24 +171,24 @@ public function registerOrderComplete($orderTemp, &$objCartSession, $cartKey) public static function registerShipmentItem($order_id, $shipping_id, $shipment_item) { $_SESSION['testResult']['registerShipmentItem'][] = [ - 'order_id' => $order_id, - 'shipping_id' => $shipping_id, - 'shipment_item' => $shipment_item, - ]; + 'order_id' => $order_id, + 'shipping_id' => $shipping_id, + 'shipment_item' => $shipment_item, + ]; } public static function registerShipping($order_id, $shipping_temp, $convert_shipping_date = true) { $_SESSION['testResult']['registerShipping'] = [ - 'order_id' => $order_id, - ]; + 'order_id' => $order_id, + ]; } public static function cleanupSession($order_id, &$objCartSesion, &$objCustomer, $cartKey) { $_SESSION['testResult']['cleanupSession'] = [ - 'order_id' => $order_id, - 'cartKey' => $cartKey, - ]; + 'order_id' => $order_id, + 'cartKey' => $cartKey, + ]; } } diff --git a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_copyFromCustomerTest.php b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_copyFromCustomerTest.php index ff77aa4584..4dbfbed38b 100644 --- a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_copyFromCustomerTest.php +++ b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_copyFromCustomerTest.php @@ -92,31 +92,31 @@ public function testCopyFromCustomerモバイルの場合モバイルのメー $this->customer->setValue('email_mobile', 'mobile@example.com'); $this->expected = [ - 'order_name01' => '姓01', - 'order_name02' => '名01', - 'order_kana01' => 'セイ01', - 'order_kana02' => 'メイ01', - 'order_sex' => '1', - 'order_zip01' => '123', - 'order_zip02' => '4567', - 'order_pref' => '東京都', - 'order_addr01' => 'abc市', - 'order_addr02' => 'def町', - 'order_tel01' => '01', - 'order_tel02' => '234', - 'order_tel03' => '5678', - 'order_fax01' => '02', - 'order_fax02' => '345', - 'order_fax03' => '6789', - 'order_job' => '会社員', - 'order_birth' => '2012-01-01', - 'order_email' => 'mobile@example.com', - 'customer_id' => '1001', - 'update_date' => 'CURRENT_TIMESTAMP', - 'order_country_id' => '', - 'order_company_name' => '', - 'order_zipcode' => '', - ]; + 'order_name01' => '姓01', + 'order_name02' => '名01', + 'order_kana01' => 'セイ01', + 'order_kana02' => 'メイ01', + 'order_sex' => '1', + 'order_zip01' => '123', + 'order_zip02' => '4567', + 'order_pref' => '東京都', + 'order_addr01' => 'abc市', + 'order_addr02' => 'def町', + 'order_tel01' => '01', + 'order_tel02' => '234', + 'order_tel03' => '5678', + 'order_fax01' => '02', + 'order_fax02' => '345', + 'order_fax03' => '6789', + 'order_job' => '会社員', + 'order_birth' => '2012-01-01', + 'order_email' => 'mobile@example.com', + 'customer_id' => '1001', + 'update_date' => 'CURRENT_TIMESTAMP', + 'order_country_id' => '', + 'order_company_name' => '', + 'order_zipcode' => '', + ]; $helper = new SC_Helper_Purchase_Ex(); $helper->copyFromCustomer($dest, $this->customer); $this->actual = $dest; @@ -134,11 +134,11 @@ public function testCopyFromCustomerモバイルかつモバイルのメール User_Utils::setDeviceType(DEVICE_TYPE_MOBILE); $this->expected = [ - 'order_name01' => '姓01', - 'order_email' => 'test@example.com', - 'customer_id' => '1001', - 'update_date' => 'CURRENT_TIMESTAMP', - ]; + 'order_name01' => '姓01', + 'order_email' => 'test@example.com', + 'customer_id' => '1001', + 'update_date' => 'CURRENT_TIMESTAMP', + ]; $helper = new SC_Helper_Purchase_Ex(); $helper->copyFromCustomer($dest, $this->customer, $prefix, $keys); $this->actual = $dest; @@ -157,11 +157,11 @@ public function testCopyFromCustomerモバイルでない場合通常のメー $this->customer->setValue('email_mobile', 'mobile@example.com'); $this->expected = [ - 'prefix_name01' => '姓01', - 'prefix_email' => 'test@example.com', - 'customer_id' => '1001', - 'update_date' => 'CURRENT_TIMESTAMP', - ]; + 'prefix_name01' => '姓01', + 'prefix_email' => 'test@example.com', + 'customer_id' => '1001', + 'update_date' => 'CURRENT_TIMESTAMP', + ]; $helper = new SC_Helper_Purchase_Ex(); $helper->copyFromCustomer($dest, $this->customer, $prefix, $keys); $this->actual = $dest; diff --git a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_copyFromOrderTest.php b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_copyFromOrderTest.php index 7f006732d6..96423f5440 100644 --- a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_copyFromOrderTest.php +++ b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_copyFromOrderTest.php @@ -48,42 +48,42 @@ public function testCopyFromOrder全てデフォルト設定にした場合デ { $dest = []; $src = [ - 'order_name01' => '姓', - 'order_name02' => '名', - 'order_kana01' => 'セイ', - 'order_kana02' => 'メイ', - 'order_sex' => '1', - 'order_zip01' => '012', - 'order_zip02' => '1234', - 'order_pref' => '北海道', - 'order_addr01' => '住所01', - 'order_addr02' => '住所02', - 'order_tel01' => '01', - 'order_tel02' => '1234', - 'order_tel03' => '5678', - 'order_fax01' => '02', - 'order_fax02' => '2345', - 'order_fax03' => '6789', - ]; + 'order_name01' => '姓', + 'order_name02' => '名', + 'order_kana01' => 'セイ', + 'order_kana02' => 'メイ', + 'order_sex' => '1', + 'order_zip01' => '012', + 'order_zip02' => '1234', + 'order_pref' => '北海道', + 'order_addr01' => '住所01', + 'order_addr02' => '住所02', + 'order_tel01' => '01', + 'order_tel02' => '1234', + 'order_tel03' => '5678', + 'order_fax01' => '02', + 'order_fax02' => '2345', + 'order_fax03' => '6789', + ]; $this->expected = [ - 'shipping_name01' => '姓', - 'shipping_name02' => '名', - 'shipping_kana01' => 'セイ', - 'shipping_kana02' => 'メイ', - 'shipping_sex' => '1', - 'shipping_zip01' => '012', - 'shipping_zip02' => '1234', - 'shipping_pref' => '北海道', - 'shipping_addr01' => '住所01', - 'shipping_addr02' => '住所02', - 'shipping_tel01' => '01', - 'shipping_tel02' => '1234', - 'shipping_tel03' => '5678', - 'shipping_fax01' => '02', - 'shipping_fax02' => '2345', - 'shipping_fax03' => '6789', - ]; + 'shipping_name01' => '姓', + 'shipping_name02' => '名', + 'shipping_kana01' => 'セイ', + 'shipping_kana02' => 'メイ', + 'shipping_sex' => '1', + 'shipping_zip01' => '012', + 'shipping_zip02' => '1234', + 'shipping_pref' => '北海道', + 'shipping_addr01' => '住所01', + 'shipping_addr02' => '住所02', + 'shipping_tel01' => '01', + 'shipping_tel02' => '1234', + 'shipping_tel03' => '5678', + 'shipping_fax01' => '02', + 'shipping_fax02' => '2345', + 'shipping_fax03' => '6789', + ]; $helper = new SC_Helper_Purchase_Ex(); $helper->copyFromOrder($dest, $src); $this->actual = $dest; @@ -95,15 +95,15 @@ public function testCopyFromOrder接頭辞・キーを設定した場合指定 { $dest = []; $src = [ - 'input_name01' => '姓', - 'input_name02' => '名', - 'input_zip01' => '012', // キーに含まれないもの - ]; + 'input_name01' => '姓', + 'input_name02' => '名', + 'input_zip01' => '012', // キーに含まれないもの + ]; $this->expected = [ - 'output_name01' => '姓', - 'output_name02' => '名', - ]; + 'output_name01' => '姓', + 'output_name02' => '名', + ]; $helper = new SC_Helper_Purchase_Ex(); $helper->copyFromOrder($dest, $src, 'output', 'input', ['name01', 'name02']); $this->actual = $dest; diff --git a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_extractShippingTest.php b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_extractShippingTest.php index d0a16df7b8..84a550d495 100644 --- a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_extractShippingTest.php +++ b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_extractShippingTest.php @@ -49,17 +49,17 @@ public function testExtractShipping予め指定されたキーだけが抽出さ $helper = new SC_Helper_Purchase_Ex(); $helper->arrShippingKey = ['id', 'name', 'code']; $arrSrc = [ - 'shipping_id' => '1001', - 'shipping_code' => 'cd1001', - 'shipping_detail' => 'dt1001', // 無視される - 'shipping_name' => '名称1001', - ]; + 'shipping_id' => '1001', + 'shipping_code' => 'cd1001', + 'shipping_detail' => 'dt1001', // 無視される + 'shipping_name' => '名称1001', + ]; $this->expected = [ - 'shipping_id' => '1001', - 'shipping_name' => '名称1001', - 'shipping_code' => 'cd1001', - ]; + 'shipping_id' => '1001', + 'shipping_name' => '名称1001', + 'shipping_code' => 'cd1001', + ]; $this->actual = $helper->extractShipping($arrSrc); $this->verify(); diff --git a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getOrderDetailTest.php b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getOrderDetailTest.php index c91b7f37ad..fdbab92fef 100644 --- a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getOrderDetailTest.php +++ b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getOrderDetailTest.php @@ -64,10 +64,10 @@ public function testGetOrderDetail存在しない受注IDを指定した場合 public function testGetOrderDetail存在する受注IDを指定した場合対応する受注詳細情報が取得できる() { $properties = [ - 'product_id', 'product_class_id', 'product_type_id', 'product_code', - 'product_name', 'classcategory_name1', 'classcategory_name2', 'price', - 'quantity', 'point_rate', 'status', 'payment_date', 'enable', 'effective', - 'tax_rate', 'tax_rule', ]; + 'product_id', 'product_class_id', 'product_type_id', 'product_code', + 'product_name', 'classcategory_name1', 'classcategory_name2', 'price', + 'quantity', 'point_rate', 'status', 'payment_date', 'enable', 'effective', + 'tax_rate', 'tax_rule', ]; $this->objQuery->setOrder('order_detail_id'); $arrOrderDetails = $this->objQuery->select('*', 'dtb_order_detail T1 JOIN dtb_order T2 ON T1.order_id = T2.order_id', 'T1.order_id = ?', [$this->order_ids[0]]); @@ -101,10 +101,10 @@ public function testGetOrderDetail存在する受注IDを指定した場合対 public function testGetOrderDetailステータス取得フラグがOFFのの場合ステータス以外の情報が取得できる() { $properties = [ - 'product_id', 'product_class_id', 'product_type_id', 'product_code', - 'product_name', 'classcategory_name1', 'classcategory_name2', 'price', - 'quantity', 'point_rate', 'enable', 'effective', - 'tax_rate', 'tax_rule', ]; + 'product_id', 'product_class_id', 'product_type_id', 'product_code', + 'product_name', 'classcategory_name1', 'classcategory_name2', 'price', + 'quantity', 'point_rate', 'enable', 'effective', + 'tax_rate', 'tax_rule', ]; $this->objQuery->setOrder('order_detail_id'); $arrOrderDetails = $this->objQuery->select('*', 'dtb_order_detail T1 JOIN dtb_order T2 ON T1.order_id = T2.order_id', 'T1.order_id = ?', [$this->order_ids[0]]); diff --git a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getOrderTempTest.php b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getOrderTempTest.php index ba100a8433..a1a9995750 100644 --- a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getOrderTempTest.php +++ b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getOrderTempTest.php @@ -58,7 +58,7 @@ public function testGetOrderTemp存在しない受注IDを指定した場合結 { $order_id = '9999'; - $this->expected = null; + $this->expected = []; $this->actual = SC_Helper_Purchase::getOrderTemp($order_id); $this->verify(); @@ -70,10 +70,10 @@ public function testGetOrderTemp存在する受注IDを指定した場合対応 $arrCustomer = $this->objQuery->getRow('*', 'dtb_customer', 'customer_id = ?', [$this->customer_ids[0]]); $this->expected = [ - 'order_temp_id' => $order_temp_id, - 'customer_id' => $this->customer_ids[0], - 'order_name01' => $arrCustomer['name01'], - ]; + 'order_temp_id' => $order_temp_id, + 'customer_id' => $this->customer_ids[0], + 'order_name01' => $arrCustomer['name01'], + ]; $result = SC_Helper_Purchase::getOrderTemp($order_temp_id); $this->actual = Test_Utils::mapArray($result, ['order_temp_id', 'customer_id', 'order_name01']); diff --git a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getOrderTest.php b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getOrderTest.php index 8a347979db..cb11252cce 100644 --- a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getOrderTest.php +++ b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getOrderTest.php @@ -77,10 +77,10 @@ public function testGetOrder顧客IDを指定しなかった場合受注IDに対 $order_id = $this->order_ids[1]; $this->expected = [ - 'order_id' => $order_id, - 'customer_id' => $this->customer_ids[1], - 'order_name01' => '受注情報02', - ]; + 'order_id' => $order_id, + 'customer_id' => $this->customer_ids[1], + 'order_name01' => '受注情報02', + ]; $result = SC_Helper_Purchase::getOrder($order_id); $this->actual = Test_Utils::mapArray($result, ['order_id', 'customer_id', 'order_name01']); @@ -93,10 +93,10 @@ public function testGetOrder存在する顧客IDを指定した場合対応す $customer_id = $this->customer_ids[1]; $this->expected = [ - 'order_id' => $order_id, - 'customer_id' => $customer_id, - 'order_name01' => '受注情報02', - ]; + 'order_id' => $order_id, + 'customer_id' => $customer_id, + 'order_name01' => '受注情報02', + ]; $result = SC_Helper_Purchase::getOrder($order_id, $customer_id); $this->actual = Test_Utils::mapArray($result, ['order_id', 'customer_id', 'order_name01']); diff --git a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getShipmentItemsTest.php b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getShipmentItemsTest.php index 3205bcccda..91413e8046 100644 --- a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getShipmentItemsTest.php +++ b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getShipmentItemsTest.php @@ -81,30 +81,36 @@ public function testGetShipmentItems存在する受注IDと配送先IDを指定 $this->expected['count'] = 2; $this->expected['second'] = [ - 'order_id' => (string) $order_id, - 'shipping_id' => '0', - 'product_class_id' => '2', - 'product_name' => 'アイスクリーム', - 'price' => '1008', - 'productsClass' => ['product_class_id' => '2', 'product_id' => '1'], - ]; + 'order_id' => (string) $order_id, + 'shipping_id' => '0', + 'product_class_id' => '2', + 'product_name' => 'アイスクリーム', + 'price' => '1008', + 'productsClass' => ['product_class_id' => '2', 'product_id' => '1'], + ]; $this->expected['first'] = [ - 'order_id' => (string) $order_id, - 'shipping_id' => '0', - 'product_class_id' => '1', - 'product_name' => 'アイスクリーム', - 'price' => '1008', - 'productsClass' => ['product_class_id' => '1', 'product_id' => '1'], - ]; + 'order_id' => (string) $order_id, + 'shipping_id' => '0', + 'product_class_id' => '1', + 'product_name' => 'アイスクリーム', + 'price' => '1008', + 'productsClass' => ['product_class_id' => '1', 'product_id' => '1'], + ]; $result = SC_Helper_Purchase::getShipmentItems($order_id, $shipping_id); $this->actual['count'] = count($result); - $this->actual['first'] = Test_Utils::mapArray($result[0], [ - 'order_id', 'shipping_id', 'product_class_id', 'product_name', 'price', 'productsClass', ]); + $this->actual['first'] = Test_Utils::mapArray($result[0], + [ + 'order_id', 'shipping_id', 'product_class_id', 'product_name', 'price', 'productsClass', + ] + ); $this->actual['first']['productsClass'] = Test_Utils::mapArray($this->actual['first']['productsClass'], ['product_class_id', 'product_id']); - $this->actual['second'] = Test_Utils::mapArray($result[1], [ - 'order_id', 'shipping_id', 'product_class_id', 'product_name', 'price', 'productsClass', ]); + $this->actual['second'] = Test_Utils::mapArray($result[1], + [ + 'order_id', 'shipping_id', 'product_class_id', 'product_name', 'price', 'productsClass', + ] + ); $this->actual['second']['productsClass'] = Test_Utils::mapArray($this->actual['second']['productsClass'], ['product_class_id', 'product_id']); $this->verify('配送情報'); } @@ -116,28 +122,30 @@ public function testGetShipmentItems詳細フラグをOFFにした場合結果 $this->expected['count'] = 2; $this->expected['second'] = [ - 'order_id' => (string) $order_id, - 'shipping_id' => '0', - 'product_class_id' => '2', - 'product_name' => 'アイスクリーム', - 'price' => '1008', - 'productsClass' => null, - ]; + 'order_id' => (string) $order_id, + 'shipping_id' => '0', + 'product_class_id' => '2', + 'product_name' => 'アイスクリーム', + 'price' => '1008', + 'productsClass' => null, + ]; $this->expected['first'] = [ - 'order_id' => (string) $order_id, - 'shipping_id' => '0', - 'product_class_id' => '1', - 'product_name' => 'アイスクリーム', - 'price' => '1008', - 'productsClass' => null, - ]; + 'order_id' => (string) $order_id, + 'shipping_id' => '0', + 'product_class_id' => '1', + 'product_name' => 'アイスクリーム', + 'price' => '1008', + 'productsClass' => null, + ]; $result = SC_Helper_Purchase::getShipmentItems($order_id, $shipping_id, false); $this->actual['count'] = count($result); $this->actual['first'] = Test_Utils::mapArray($result[0], [ - 'order_id', 'shipping_id', 'product_class_id', 'product_name', 'price', 'productsClass', ]); + 'order_id', 'shipping_id', 'product_class_id', 'product_name', 'price', 'productsClass', + ]); $this->actual['second'] = Test_Utils::mapArray($result[1], [ - 'order_id', 'shipping_id', 'product_class_id', 'product_name', 'price', 'productsClass', ]); + 'order_id', 'shipping_id', 'product_class_id', 'product_name', 'price', 'productsClass', + ]); $this->verify('配送情報'); } diff --git a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getShippingTempTest.php b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getShippingTempTest.php index a625c6775a..b1099094ce 100644 --- a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getShippingTempTest.php +++ b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getShippingTempTest.php @@ -59,15 +59,17 @@ public function testGetShippingTemp保有フラグがONの場合商品のある $this->setUpShipping($this->getMultipleShipping()); $this->expected = [ - '00001' => [ - 'shipment_id' => '00001', - 'shipment_item' => ['商品1'], - 'shipping_pref' => '東京都', ], - '00002' => [ - 'shipment_id' => '00002', - 'shipment_item' => ['商品2'], - 'shipping_pref' => '沖縄県', ], - ]; + '00001' => [ + 'shipment_id' => '00001', + 'shipment_item' => ['商品1'], + 'shipping_pref' => '東京都', + ], + '00002' => [ + 'shipment_id' => '00002', + 'shipment_item' => ['商品2'], + 'shipping_pref' => '沖縄県', + ], + ]; $this->actual = SC_Helper_Purchase::getShippingTemp(true); $this->verify('配送情報'); diff --git a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getShippingsTest.php b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getShippingsTest.php index 6486973ae0..7261d688d0 100644 --- a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getShippingsTest.php +++ b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_getShippingsTest.php @@ -68,11 +68,11 @@ public function testGetShippings存在する受注IDを指定した場合結果 $arrCustomer = $this->objQuery->getRow('*', 'dtb_customer', 'customer_id = ?', [$this->customer_ids[0]]); $this->expected['count'] = 1; $this->expected['first'] = [ - 'order_id' => (string) $order_id, - 'shipping_id' => '0', - 'shipping_name01' => $arrCustomer['name01'], - 'shipping_date' => null, - ]; + 'order_id' => (string) $order_id, + 'shipping_id' => '0', + 'shipping_name01' => $arrCustomer['name01'], + 'shipping_date' => null, + ]; $this->expected['shipment_item_count'] = 3; $helper = new SC_Helper_Purchase_Ex(); @@ -81,7 +81,8 @@ public function testGetShippings存在する受注IDを指定した場合結果 $this->actual['count'] = count($result); // shipping_idごとの配列になっているのでshipping_idで抽出 $this->actual['first'] = Test_Utils::mapArray($result[0], [ - 'order_id', 'shipping_id', 'shipping_name01', 'shipping_date', ]); + 'order_id', 'shipping_id', 'shipping_name01', 'shipping_date', + ]); $this->actual['shipment_item_count'] = count($result[0]['shipment_item']); $this->verify('配送情報'); } @@ -93,11 +94,11 @@ public function testGetShippings商品取得フラグをOFFにした場合結果 $this->expected['count'] = 1; $this->expected['first'] = [ - 'order_id' => (string) $order_id, - 'shipping_id' => '0', - 'shipping_name01' => $arrCustomer['name01'], - 'shipping_date' => null, - ]; + 'order_id' => (string) $order_id, + 'shipping_id' => '0', + 'shipping_name01' => $arrCustomer['name01'], + 'shipping_date' => null, + ]; $this->expected['shipment_item_count'] = 0; $helper = new SC_Helper_Purchase_Ex(); @@ -105,7 +106,8 @@ public function testGetShippings商品取得フラグをOFFにした場合結果 $this->actual['count'] = count($result); // shipping_idごとの配列になっているのでshipping_idで抽出 $this->actual['first'] = Test_Utils::mapArray($result[0], [ - 'order_id', 'shipping_id', 'shipping_name01', 'shipping_date', ]); + 'order_id', 'shipping_id', 'shipping_name01', 'shipping_date', + ]); $this->actual['shipment_item_count'] = is_array($result['1']['shipment_item']) ? count($result['1']['shipment_item']) : 0; $this->verify('配送情報'); } diff --git a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_registerOrderCompleteTest.php b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_registerOrderCompleteTest.php index ff0e17ac97..412860357f 100644 --- a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_registerOrderCompleteTest.php +++ b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_registerOrderCompleteTest.php @@ -61,45 +61,45 @@ public function testRegisterOrderComplete不要な変数が含まれている場 { // 引数の準備 $orderParams = [ - 'order_id' => $this->order_ids[0], - 'status' => ORDER_PAY_WAIT, - 'mail_maga_flg' => '1', - 'order_tax_rate' => '5', - 'order_tax_rule' => '1', - ]; + 'order_id' => $this->order_ids[0], + 'status' => ORDER_PAY_WAIT, + 'mail_maga_flg' => '1', + 'order_tax_rate' => '5', + 'order_tax_rule' => '1', + ]; $cartSession = new SC_CartSession_registerOrderCompleteMock(); $_SESSION['site']['uniqid'] = $this->order_temp_ids[0]; $this->helper->registerOrderComplete($orderParams, $cartSession, '1'); $this->expected = [ - 'registerOrder' => [ - 'order_id' => $this->order_ids[0], - 'status' => ORDER_PAY_WAIT, - 'mailmaga_flg' => null, - ], - 'registerOrderDetail' => [ - 'order_id' => $this->order_ids[0], - 'params' => [ - [ - 'order_id' => $this->order_ids[0], - 'product_id' => '1002', - 'product_class_id' => '1002', - 'product_name' => '製品02', - 'product_code' => 'cd1002', - 'classcategory_name1' => 'cat01', - 'classcategory_name2' => 'cat02', - 'point_rate' => '5', - 'price' => '1000', - 'quantity' => '10', - 'tax_rate' => null, - 'tax_rule' => null, - 'tax_adjust' => null, - ], - ], - ], - 'del_flg' => '1', - ]; + 'registerOrder' => [ + 'order_id' => $this->order_ids[0], + 'status' => ORDER_PAY_WAIT, + 'mailmaga_flg' => null, + ], + 'registerOrderDetail' => [ + 'order_id' => $this->order_ids[0], + 'params' => [ + [ + 'order_id' => $this->order_ids[0], + 'product_id' => '1002', + 'product_class_id' => '1002', + 'product_name' => '製品02', + 'product_code' => 'cd1002', + 'classcategory_name1' => 'cat01', + 'classcategory_name2' => 'cat02', + 'point_rate' => '5', + 'price' => '1000', + 'quantity' => '10', + 'tax_rate' => null, + 'tax_rule' => null, + 'tax_adjust' => null, + ], + ], + ], + 'del_flg' => '1', + ]; $this->actual = $_SESSION['testResult']; $this->actual['del_flg'] = $this->objQuery->get('del_flg', 'dtb_order_temp', 'order_temp_id = ?', $this->order_temp_ids[0]); @@ -110,11 +110,11 @@ public function testRegisterOrderCompleteステータスの指定がない場合 { // 引数の準備 $orderParams = [ - 'order_id' => '1001', - // 'status' => ORDER_PAY_WAIT, - 'order_tax_rate' => '5', - 'order_tax_rule' => '1', - ]; + 'order_id' => '1001', + // 'status' => ORDER_PAY_WAIT, + 'order_tax_rate' => '5', + 'order_tax_rule' => '1', + ]; $cartSession = new SC_CartSession_registerOrderCompleteMock(); $_SESSION['site']['uniqid'] = '1001'; @@ -122,12 +122,12 @@ public function testRegisterOrderCompleteステータスの指定がない場合 // 上の条件と重複する部分は確認を省略 $this->expected = [ - 'registerOrder' => [ - 'order_id' => '1001', - 'status' => ORDER_NEW, - 'mailmaga_flg' => null, - ], - ]; + 'registerOrder' => [ + 'order_id' => '1001', + 'status' => ORDER_NEW, + 'mailmaga_flg' => null, + ], + ]; $this->actual['registerOrder'] = $_SESSION['testResult']['registerOrder']; $this->verify(); @@ -141,18 +141,18 @@ class SC_Helper_Purchase_registerOrderCompleteMock extends SC_Helper_Purchase public static function registerOrder($order_id, $params) { $_SESSION['testResult']['registerOrder'] = [ - 'order_id' => $order_id, - 'status' => $params['status'], - 'mailmaga_flg' => $params['mailmaga_flg'], - ]; + 'order_id' => $order_id, + 'status' => $params['status'], + 'mailmaga_flg' => $params['mailmaga_flg'], + ]; } public static function registerOrderDetail($order_id, $params) { $_SESSION['testResult']['registerOrderDetail'] = [ - 'order_id' => $order_id, - 'params' => $params, - ]; + 'order_id' => $order_id, + 'params' => $params, + ]; } public function setUniqId() @@ -166,19 +166,19 @@ class SC_CartSession_registerOrderCompleteMock extends SC_CartSession public function getCartList($cartKey, $pref_id = 0, $country_id = 0) { return [ - [ - 'productsClass' => [ - 'product_id' => '1002', - 'product_class_id' => '1002', - 'name' => '製品02', - 'product_code' => 'cd1002', - 'classcategory_name1' => 'cat01', - 'classcategory_name2' => 'cat02', - ], - 'point_rate' => '5', - 'price' => '1000', - 'quantity' => '10', - ], - ]; + [ + 'productsClass' => [ + 'product_id' => '1002', + 'product_class_id' => '1002', + 'name' => '製品02', + 'product_code' => 'cd1002', + 'classcategory_name1' => 'cat01', + 'classcategory_name2' => 'cat02', + ], + 'point_rate' => '5', + 'price' => '1000', + 'quantity' => '10', + ], + ]; } } diff --git a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_registerOrderDetailTest.php b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_registerOrderDetailTest.php index 90cc896aef..d878c72b75 100644 --- a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_registerOrderDetailTest.php +++ b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_registerOrderDetailTest.php @@ -54,24 +54,24 @@ protected function tearDown(): void public function testRegisterOrderDetail該当の受注が存在する場合削除後に新しい情報が登録される() { $params = [ - [ - 'order_id' => $this->order_ids[0], - 'hoge' => '999', // DBに存在しないカラム - 'product_id' => '9001', - 'product_class_id' => '9001', - 'product_name' => '製品名9001', - ], - ]; + [ + 'order_id' => $this->order_ids[0], + 'hoge' => '999', // DBに存在しないカラム + 'product_id' => '9001', + 'product_class_id' => '9001', + 'product_name' => '製品名9001', + ], + ]; SC_Helper_Purchase::registerOrderDetail($this->order_ids[0], $params); $this->expected['count'] = '1'; $this->expected['content'] = [ - 'order_id' => $this->order_ids[0], - 'product_id' => '9001', - 'product_class_id' => '9001', - 'product_name' => '製品名9001', - 'product_code' => null, // 古いデータにはあるが、deleteされたので消えている - ]; + 'order_id' => $this->order_ids[0], + 'product_id' => '9001', + 'product_class_id' => '9001', + 'product_name' => '製品名9001', + 'product_code' => null, // 古いデータにはあるが、deleteされたので消えている + ]; $this->actual['count'] = $this->objQuery->count('dtb_order_detail', 'order_id = ?', [$this->order_ids[0]]); $this->actual['content'] = $this->objQuery->getRow( @@ -87,24 +87,24 @@ public function testRegisterOrderDetail該当の受注が存在する場合削 public function testRegisterOrderDetail該当の受注が存在しない場合新しい情報が追加登録される() { $params = [ - [ - 'order_id' => '1003', - 'hoge' => '999', // DBに存在しないカラム - 'product_id' => '9003', - 'product_class_id' => '9003', - 'product_name' => '製品名9003', - ], - ]; + [ + 'order_id' => '1003', + 'hoge' => '999', // DBに存在しないカラム + 'product_id' => '9003', + 'product_class_id' => '9003', + 'product_name' => '製品名9003', + ], + ]; SC_Helper_Purchase::registerOrderDetail('1003', $params); $this->expected['count'] = '1'; $this->expected['content'] = [ - 'order_id' => '1003', - 'product_id' => '9003', - 'product_class_id' => '9003', - 'product_name' => '製品名9003', - 'product_code' => null, - ]; + 'order_id' => '1003', + 'product_id' => '9003', + 'product_class_id' => '9003', + 'product_name' => '製品名9003', + 'product_code' => null, + ]; $this->actual['count'] = $this->objQuery->count('dtb_order_detail', 'order_id = ?', [1003]); $result = $this->objQuery->select( diff --git a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_registerOrderTest.php b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_registerOrderTest.php index 0a754664ac..b86c05547e 100644 --- a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_registerOrderTest.php +++ b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_registerOrderTest.php @@ -67,20 +67,20 @@ public function testRegisterOrder既に受注IDが存在する場合情報が更 $this->expected = [ 'sfUpdateOrderStatus' => [ - 'order_id' => $order_id, - 'status' => '1', - 'add_point' => 10, - 'use_point' => 20, + 'order_id' => $order_id, + 'status' => '1', + 'add_point' => 10, + 'use_point' => 20, ], 'sfUpdateOrderNameCol' => $order_id, 'count' => '2', 'content' => [ - 'order_id' => $order_id, - 'customer_id' => $this->customer_ids[0], - 'status' => '1', - 'add_point' => '10', - 'use_point' => '20', - 'order_name01' => '受注情報01_更新', + 'order_id' => $order_id, + 'customer_id' => $this->customer_ids[0], + 'status' => '1', + 'add_point' => '10', + 'use_point' => '20', + 'order_name01' => '受注情報01_更新', ], ]; $this->actual = $_SESSION['testResult']; @@ -111,20 +111,20 @@ public function testRegisterOrder存在しない受注IDを指定した場合新 $this->expected = [ 'sfUpdateOrderStatus' => [ - 'order_id' => '1003', - 'status' => '2', - 'add_point' => 100, - 'use_point' => 200, + 'order_id' => '1003', + 'status' => '2', + 'add_point' => 100, + 'use_point' => 200, ], 'sfUpdateOrderNameCol' => '1003', 'count' => '3', 'content' => [ - 'order_id' => '1003', - 'customer_id' => '1003', - 'status' => null, // ここではsfUpdateOrderStatusをモックにしているので更新されない - 'add_point' => '100', - 'use_point' => '200', - 'order_name01' => '受注情報03', + 'order_id' => '1003', + 'customer_id' => '1003', + 'status' => null, // ここではsfUpdateOrderStatusをモックにしているので更新されない + 'add_point' => '100', + 'use_point' => '200', + 'order_name01' => '受注情報03', ], ]; $this->actual = $_SESSION['testResult']; diff --git a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_registerShipmentItemTest.php b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_registerShipmentItemTest.php index e6bd91ccab..e3ed6f7b2e 100644 --- a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_registerShipmentItemTest.php +++ b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_registerShipmentItemTest.php @@ -57,15 +57,15 @@ public function testRegisterShipmentItem製品クラスIDが入っていない $order_id = '1'; $shipping_id = '1'; $arrParams = [ - [ - // 'product_class_id' => '1', - 'product_name' => '追加製品名01', - 'product_code' => 'newcode01', - 'classcategory_name1' => 'newcat01', - 'classcategory_name2' => 'newcat02', - 'price' => '2500', - ], - ]; + [ + // 'product_class_id' => '1', + 'product_name' => '追加製品名01', + 'product_code' => 'newcode01', + 'classcategory_name1' => 'newcat01', + 'classcategory_name2' => 'newcat02', + 'price' => '2500', + ], + ]; // 期待値の設定 $this->expected['count'] = 0; @@ -89,26 +89,26 @@ public function testRegisterShipmentItem製品名等が指定されている場 $order_id = $this->order_ids[0]; $shipping_id = '0'; $arrParams = [ - [ - 'product_class_id' => '1', - 'product_name' => '追加製品名01', - 'product_code' => 'newcode01', - 'classcategory_name1' => 'newcat01', - 'classcategory_name2' => 'newcat02', - 'price' => '2500', - ], - ]; + [ + 'product_class_id' => '1', + 'product_name' => '追加製品名01', + 'product_code' => 'newcode01', + 'classcategory_name1' => 'newcat01', + 'classcategory_name2' => 'newcat02', + 'price' => '2500', + ], + ]; // 期待値の設定 $this->expected['count'] = 1; $this->expected['first'] = [ - 'product_class_id' => '1', - 'product_name' => '追加製品名01', - 'product_code' => 'newcode01', - 'classcategory_name1' => 'newcat01', - 'classcategory_name2' => 'newcat02', - 'price' => '2500', - ]; + 'product_class_id' => '1', + 'product_name' => '追加製品名01', + 'product_code' => 'newcode01', + 'classcategory_name1' => 'newcat01', + 'classcategory_name2' => 'newcat02', + 'price' => '2500', + ]; // 対象functionの呼び出し SC_Helper_Purchase::registerShipmentItem($order_id, $shipping_id, $arrParams); @@ -131,28 +131,28 @@ public function testRegisterShipmentItem製品名等が指定されていない $order_id = $this->order_ids[0]; $shipping_id = '1'; $arrParams = [ - [ - 'product_class_id' => '1', - // 'product_name' => '追加製品名01', - // 'product_code' => 'newcode01', - // 'classcategory_name1' => 'newcat01', - // 'classcategory_name2' => 'newcat02', - // 'price' => '2500' - ], - ]; + [ + 'product_class_id' => '1', + // 'product_name' => '追加製品名01', + // 'product_code' => 'newcode01', + // 'classcategory_name1' => 'newcat01', + // 'classcategory_name2' => 'newcat02', + // 'price' => '2500' + ], + ]; // 期待値の設定 $this->expected['count'] = 1; $this->expected['first'] = [ - 'product_class_id' => '1', - 'product_name' => 'アイスクリーム', - 'product_code' => 'ice-01', - 'classcategory_name1' => '抹茶', - 'classcategory_name2' => 'S', - // TODO 要確認price01, price02を設定しても価格が取れない。実際にはDBから取るケースが無い? - // 'price' => '1500' - 'price' => null, - ]; + 'product_class_id' => '1', + 'product_name' => 'アイスクリーム', + 'product_code' => 'ice-01', + 'classcategory_name1' => '抹茶', + 'classcategory_name2' => 'S', + // TODO 要確認price01, price02を設定しても価格が取れない。実際にはDBから取るケースが無い? + // 'price' => '1500' + 'price' => null, + ]; // 対象functionの呼び出し SC_Helper_Purchase::registerShipmentItem($order_id, $shipping_id, $arrParams); @@ -174,27 +174,27 @@ public function testRegisterShipmentItemDBに存在しないカラムを指定 $order_id = '1'; $shipping_id = '1'; $arrParams = [ - [ - 'product_class_id' => '1', - 'product_name' => '追加製品名01', - 'product_code' => 'newcode01', - 'classcategory_name1' => 'newcat01', - 'classcategory_name2' => 'newcat02', - 'price' => '2500', - 'xxxx' => 'yyyyyy', // 存在しないカラム - ], - ]; + [ + 'product_class_id' => '1', + 'product_name' => '追加製品名01', + 'product_code' => 'newcode01', + 'classcategory_name1' => 'newcat01', + 'classcategory_name2' => 'newcat02', + 'price' => '2500', + 'xxxx' => 'yyyyyy', // 存在しないカラム + ], + ]; // 期待値の設定 $this->expected['count'] = 1; $this->expected['first'] = [ - 'product_class_id' => '1', - 'product_name' => '追加製品名01', - 'product_code' => 'newcode01', - 'classcategory_name1' => 'newcat01', - 'classcategory_name2' => 'newcat02', - 'price' => '2500', - ]; + 'product_class_id' => '1', + 'product_name' => '追加製品名01', + 'product_code' => 'newcode01', + 'classcategory_name1' => 'newcat01', + 'classcategory_name2' => 'newcat02', + 'price' => '2500', + ]; // 対象functionの呼び出し SC_Helper_Purchase::registerShipmentItem($order_id, $shipping_id, $arrParams); diff --git a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_registerShippingTest.php b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_registerShippingTest.php index 238f7eaed5..4c53264dc1 100644 --- a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_registerShippingTest.php +++ b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_registerShippingTest.php @@ -49,21 +49,21 @@ public function testRegisterShipping元々存在しない受注IDの場合新規 { $order_id = '10'; $arrParams = [ - '20' => [ - 'order_id' => '10', - 'shipping_id' => '20', - 'shipping_name01' => '配送情報10', - 'shipping_date' => '2012/01/12', - ], - ]; + '20' => [ + 'order_id' => '10', + 'shipping_id' => '20', + 'shipping_name01' => '配送情報10', + 'shipping_date' => '2012/01/12', + ], + ]; $this->expected['count'] = '4'; // 1件増える $this->expected['content'] = [ - 'order_id' => '10', - 'shipping_id' => '20', - 'shipping_name01' => '配送情報10', - 'shipping_date' => '2012-01-12 00:00:00', - ]; + 'order_id' => '10', + 'shipping_id' => '20', + 'shipping_name01' => '配送情報10', + 'shipping_date' => '2012-01-12 00:00:00', + ]; SC_Helper_Purchase::registerShipping($order_id, $arrParams); @@ -86,21 +86,21 @@ public function testRegisterShipping元々存在する受注IDの場合既存の { $order_id = '2'; $arrParams = [ - '30' => [ - 'order_id' => '2', - 'shipping_id' => '30', - 'shipping_name01' => '配送情報02-update', - 'shipping_date' => '2013/12/03', - ], - ]; + '30' => [ + 'order_id' => '2', + 'shipping_id' => '30', + 'shipping_name01' => '配送情報02-update', + 'shipping_date' => '2013/12/03', + ], + ]; $this->expected['count'] = '3'; // 件数が変わらない $this->expected['content'] = [ - 'order_id' => '2', - 'shipping_id' => '30', - 'shipping_name01' => '配送情報02-update', - 'shipping_date' => '2013-12-03 00:00:00', - ]; + 'order_id' => '2', + 'shipping_id' => '30', + 'shipping_name01' => '配送情報02-update', + 'shipping_date' => '2013-12-03 00:00:00', + ]; SC_Helper_Purchase::registerShipping($order_id, $arrParams); @@ -123,21 +123,21 @@ public function testRegisterShipping配送日付が空の場合エラーが起 { $order_id = '2'; $arrParams = [ - '30' => [ - 'order_id' => '2', - 'shipping_id' => '30', - 'shipping_name01' => '配送情報02-update', - // 'shipping_date' => '2013/12/03 00:00:00' - ], - ]; + '30' => [ + 'order_id' => '2', + 'shipping_id' => '30', + 'shipping_name01' => '配送情報02-update', + // 'shipping_date' => '2013/12/03 00:00:00' + ], + ]; $this->expected['count'] = '3'; $this->expected['content'] = [ - 'order_id' => '2', - 'shipping_id' => '30', - 'shipping_name01' => '配送情報02-update', - 'shipping_date' => null, - ]; + 'order_id' => '2', + 'shipping_id' => '30', + 'shipping_name01' => '配送情報02-update', + 'shipping_date' => null, + ]; SC_Helper_Purchase::registerShipping($order_id, $arrParams); @@ -160,21 +160,21 @@ public function testRegisterShipping非会員購入の場合配送IDが設定さ { $order_id = '2'; $arrParams = [ - '30' => [ - 'order_id' => '2', - // 'shipping_id' => '30', - 'shipping_name01' => '配送情報02-update', - 'shipping_date' => '2013/12/03 00:00:00', - ], - ]; + '30' => [ + 'order_id' => '2', + // 'shipping_id' => '30', + 'shipping_name01' => '配送情報02-update', + 'shipping_date' => '2013/12/03 00:00:00', + ], + ]; $this->expected['count'] = '3'; // 件数が変わらない $this->expected['content'] = [ - 'order_id' => '2', - 'shipping_id' => '30', - 'shipping_name01' => '配送情報02-update', - 'shipping_date' => '2013-12-03 00:00:00', - ]; + 'order_id' => '2', + 'shipping_id' => '30', + 'shipping_name01' => '配送情報02-update', + 'shipping_date' => '2013-12-03 00:00:00', + ]; SC_Helper_Purchase::registerShipping($order_id, $arrParams); diff --git a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_rollbackOrderTest.php b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_rollbackOrderTest.php index 37e3fe6596..6696c8c149 100644 --- a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_rollbackOrderTest.php +++ b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_rollbackOrderTest.php @@ -58,28 +58,28 @@ public function testRollbackOrderデフォルトの引数で呼び出した場 $this->actual['testResult'] = $_SESSION['testResult']; $this->actual['siteRegist'] = $_SESSION['site']['regist_success']; $this->expected = [ - 'testResult' => [ - 'cancelOrder' => [ - 'order_id' => '1001', - 'orderStatus' => ORDER_CANCEL, - 'is_delete' => false, - ], - 'getOrderTempByOrderId' => [ - 'order_id' => '1001', - ], - 'saveOrderTemp' => [ - 'uniqid' => $uniqid, - 'arrOrderTemp' => [ - 'customer_id' => '2001', - 'del_flg' => '0', - ], - ], - 'verifyChangeCart' => [ - 'uniqid' => $uniqid, - ], - ], - 'siteRegist' => true, - ]; + 'testResult' => [ + 'cancelOrder' => [ + 'order_id' => '1001', + 'orderStatus' => ORDER_CANCEL, + 'is_delete' => false, + ], + 'getOrderTempByOrderId' => [ + 'order_id' => '1001', + ], + 'saveOrderTemp' => [ + 'uniqid' => $uniqid, + 'arrOrderTemp' => [ + 'customer_id' => '2001', + 'del_flg' => '0', + ], + ], + 'verifyChangeCart' => [ + 'uniqid' => $uniqid, + ], + ], + 'siteRegist' => true, + ]; $this->verify(); } @@ -96,28 +96,28 @@ public function testRollbackOrderトランザクションが開始していな $this->actual['testResult'] = $_SESSION['testResult']; $this->actual['siteRegist'] = $_SESSION['site']['regist_success']; $this->expected = [ - 'testResult' => [ - 'cancelOrder' => [ - 'order_id' => '1001', - 'orderStatus' => ORDER_DELIV, - 'is_delete' => true, - ], - 'getOrderTempByOrderId' => [ - 'order_id' => '1001', - ], - 'saveOrderTemp' => [ - 'uniqid' => $uniqid, - 'arrOrderTemp' => [ - 'customer_id' => '2001', - 'del_flg' => '0', - ], - ], - 'verifyChangeCart' => [ - 'uniqid' => $uniqid, - ], - ], - 'siteRegist' => true, - ]; + 'testResult' => [ + 'cancelOrder' => [ + 'order_id' => '1001', + 'orderStatus' => ORDER_DELIV, + 'is_delete' => true, + ], + 'getOrderTempByOrderId' => [ + 'order_id' => '1001', + ], + 'saveOrderTemp' => [ + 'uniqid' => $uniqid, + 'arrOrderTemp' => [ + 'customer_id' => '2001', + 'del_flg' => '0', + ], + ], + 'verifyChangeCart' => [ + 'uniqid' => $uniqid, + ], + ], + 'siteRegist' => true, + ]; $this->verify(); } // //////////////////////////////////////// @@ -130,35 +130,35 @@ class SC_Helper_Purchase_rollbackOrderMock extends SC_Helper_Purchase public static function cancelOrder($order_id, $orderStatus = ORDER_CANCEL, $is_delete = false) { $_SESSION['testResult']['cancelOrder'] = [ - 'order_id' => $order_id, - 'orderStatus' => $orderStatus, - 'is_delete' => $is_delete, - ]; + 'order_id' => $order_id, + 'orderStatus' => $orderStatus, + 'is_delete' => $is_delete, + ]; } public static function getOrderTempByOrderId($order_id) { $_SESSION['testResult']['getOrderTempByOrderId'] = [ - 'order_id' => $order_id, - ]; + 'order_id' => $order_id, + ]; return [ - 'customer_id' => '2001', - ]; + 'customer_id' => '2001', + ]; } public static function saveOrderTemp($uniqid, $arrOrderTemp, &$objCustomer = null) { $_SESSION['testResult']['saveOrderTemp'] = [ - 'uniqid' => $uniqid, - 'arrOrderTemp' => $arrOrderTemp, - ]; + 'uniqid' => $uniqid, + 'arrOrderTemp' => $arrOrderTemp, + ]; } public static function verifyChangeCart($uniqid, &$objCartSession) { $_SESSION['testResult']['verifyChangeCart'] = [ - 'uniqid' => $uniqid, - ]; + 'uniqid' => $uniqid, + ]; } } diff --git a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_saveOrderTempTest.php b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_saveOrderTempTest.php index c319e9a9c0..49ef66078b 100644 --- a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_saveOrderTempTest.php +++ b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_saveOrderTempTest.php @@ -61,9 +61,9 @@ public function testSaveOrderTemp受注一時情報IDが空の場合何もしな { $this->helper->saveOrderTemp(null, [ - 'customer_id' => '1003', - 'order_name01' => '受注情報03', - 'update_date' => 'CURRENT_TIMESTAMP', + 'customer_id' => '1003', + 'order_name01' => '受注情報03', + 'update_date' => 'CURRENT_TIMESTAMP', ] ); @@ -77,20 +77,20 @@ public function testSaveOrderTemp既存の情報がない場合情報が新規 { $this->helper->saveOrderTemp('1003', [ - 'customer_id' => '1003', - 'order_name01' => '受注情報03', - 'update_date' => 'CURRENT_TIMESTAMP', + 'customer_id' => '1003', + 'order_name01' => '受注情報03', + 'update_date' => 'CURRENT_TIMESTAMP', ] ); $this->expected['count'] = '3'; $this->expected['content'] = [ - [ - 'order_temp_id' => '1003', - 'customer_id' => '1003', - 'order_name01' => '受注情報03', - ], - ]; + [ + 'order_temp_id' => '1003', + 'customer_id' => '1003', + 'order_name01' => '受注情報03', + ], + ]; $this->actual['count'] = $this->objQuery->count('dtb_order_temp'); $this->actual['content'] = $this->objQuery->select( 'order_temp_id, customer_id, order_name01', @@ -103,20 +103,20 @@ public function testSaveOrderTemp既存の情報がある場合情報が更新 { $this->helper->saveOrderTemp($this->order_temp_ids[0], [ - 'customer_id' => '2002', - 'order_name01' => '受注情報92', - 'update_date' => 'CURRENT_TIMESTAMP', + 'customer_id' => '2002', + 'order_name01' => '受注情報92', + 'update_date' => 'CURRENT_TIMESTAMP', ] ); $this->expected['count'] = '2'; $this->expected['content'] = [ - [ - 'order_temp_id' => $this->order_temp_ids[0], - 'customer_id' => '2002', - 'order_name01' => '受注情報92', - ], - ]; + [ + 'order_temp_id' => $this->order_temp_ids[0], + 'customer_id' => '2002', + 'order_name01' => '受注情報92', + ], + ]; $this->actual['count'] = $this->objQuery->count('dtb_order_temp'); $this->actual['content'] = $this->objQuery->select( 'order_temp_id, customer_id, order_name01', @@ -129,10 +129,10 @@ public function testSaveOrderTemp注文者情報がある場合情報がコピ { $this->helper->saveOrderTemp('1003', [ - 'order_temp_id' => '1003', - 'customer_id' => '1003', - 'order_name01' => '受注情報03', - 'update_date' => 'CURRENT_TIMESTAMP', + 'order_temp_id' => '1003', + 'customer_id' => '1003', + 'order_name01' => '受注情報03', + 'update_date' => 'CURRENT_TIMESTAMP', ], new SC_Customer_Ex() ); diff --git a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_saveShippingTempTest.php b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_saveShippingTempTest.php index 08a9efdf23..7ea2189462 100644 --- a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_saveShippingTempTest.php +++ b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_saveShippingTempTest.php @@ -53,11 +53,11 @@ public function testSaveShippingTemp元々存在しない配送先IDの場合新 ); $this->expected = [ - 'count' => 4, // 配送情報全体の件数 - 'shipping_id' => 0, - 'shipment_item' => null, - 'shipping_pref' => '大阪府', - ]; + 'count' => 4, // 配送情報全体の件数 + 'shipping_id' => 0, + 'shipment_item' => null, + 'shipping_pref' => '大阪府', + ]; $this->actual['count'] = count($_SESSION['shipping']); $this->actual['shipping_id'] = $_SESSION['shipping']['0']['shipping_id']; $this->actual['shipment_item'] = $_SESSION['shipping']['0']['shipment_item']; @@ -76,11 +76,11 @@ public function testSaveShippingTemp元々存在する配送先IDの場合情報 ); $this->expected = [ - 'count' => 3, // 配送情報全体の件数 - 'shipping_id' => '00001', - 'shipment_item' => ['商品1'], - 'shipping_pref' => '大阪府', - ]; + 'count' => 3, // 配送情報全体の件数 + 'shipping_id' => '00001', + 'shipment_item' => ['商品1'], + 'shipping_pref' => '大阪府', + ]; $this->actual['count'] = count($_SESSION['shipping']); $this->actual['shipping_id'] = $_SESSION['shipping']['00001']['shipping_id']; $this->actual['shipment_item'] = $_SESSION['shipping']['00001']['shipment_item']; diff --git a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_setDownloadableFlgToTest.php b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_setDownloadableFlgToTest.php index 1d80d03846..393323f016 100644 --- a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_setDownloadableFlgToTest.php +++ b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_setDownloadableFlgToTest.php @@ -47,8 +47,8 @@ protected function tearDown(): void public function testSetDownloadableFlgTo販売価格が0円の場合フラグがONになる() { $input = [ - '1001' => ['price' => 0], - ]; + '1001' => ['price' => 0], + ]; $this->expected = true; SC_Helper_Purchase::setDownloadableFlgTo($input); @@ -60,8 +60,8 @@ public function testSetDownloadableFlgTo販売価格が0円の場合フラグが public function testSetDownloadableFlgToダウンロード期限内かつ入金日ありの場合フラグがONになる() { $input = [ - '1001' => ['price' => 1000, 'effective' => '1', 'payment_date' => '2012-12-12'], - ]; + '1001' => ['price' => 1000, 'effective' => '1', 'payment_date' => '2012-12-12'], + ]; $this->expected = true; SC_Helper_Purchase::setDownloadableFlgTo($input); @@ -73,8 +73,8 @@ public function testSetDownloadableFlgToダウンロード期限内かつ入金 public function testSetDownloadableFlgToダウンロード期限内かつ入金日なしの場合フラグがOFFになる() { $input = [ - '1001' => ['price' => 1000, 'effective' => '1', 'payment_date' => null], - ]; + '1001' => ['price' => 1000, 'effective' => '1', 'payment_date' => null], + ]; $this->expected = false; SC_Helper_Purchase::setDownloadableFlgTo($input); @@ -86,8 +86,8 @@ public function testSetDownloadableFlgToダウンロード期限内かつ入金 public function testSetDownloadableFlgToダウンロード期限外かつ入金日ありの場合フラグがOFFになる() { $input = [ - '1001' => ['price' => 1000, 'effective' => '0', 'payment_date' => '2012-12-12'], - ]; + '1001' => ['price' => 1000, 'effective' => '0', 'payment_date' => '2012-12-12'], + ]; $this->expected = false; SC_Helper_Purchase::setDownloadableFlgTo($input); @@ -99,8 +99,8 @@ public function testSetDownloadableFlgToダウンロード期限外かつ入金 public function testSetDownloadableFlgToダウンロード期限外かつ入金日なしの場合フラグがOFFになる() { $input = [ - '1001' => ['price' => 1000, 'effective' => '0', 'payment_date' => null], - ]; + '1001' => ['price' => 1000, 'effective' => '0', 'payment_date' => null], + ]; $this->expected = false; SC_Helper_Purchase::setDownloadableFlgTo($input); diff --git a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_setShipmentItemTempForSoleTest.php b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_setShipmentItemTempForSoleTest.php index 1bd95d7e7f..db19e6c106 100644 --- a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_setShipmentItemTempForSoleTest.php +++ b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_setShipmentItemTempForSoleTest.php @@ -54,12 +54,12 @@ public function testSetShipmentItemTempForSoleいったん配送情報がクリ $helper->setShipmentItemTempForSole($cartSession, $shipping_id); $this->expected = [ - 'clearShipmentItemTemp' => true, - 'shipmentItemTemp' => [ - ['shipping_id' => '1001', 'id' => '1', 'quantity' => '10'], - ['shipping_id' => '1001', 'id' => '2', 'quantity' => '5'], - ], - ]; + 'clearShipmentItemTemp' => true, + 'shipmentItemTemp' => [ + ['shipping_id' => '1001', 'id' => '1', 'quantity' => '10'], + ['shipping_id' => '1001', 'id' => '2', 'quantity' => '5'], + ], + ]; $this->actual = $_SESSION['testResult']; $this->verify(); @@ -87,9 +87,9 @@ class SC_CartSession_setShipmentItemTempForSoleMock extends SC_CartSession public function getCartList($key, $pref_id = 0, $country_id = 0) { return [ - ['id' => '1', 'quantity' => '10'], - ['id' => '2', 'quantity' => '5'], - ['id' => '3', 'quantity' => '0'], - ]; + ['id' => '1', 'quantity' => '10'], + ['id' => '2', 'quantity' => '5'], + ['id' => '3', 'quantity' => '0'], + ]; } } diff --git a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_sfUpdateOrderStatusTest.php b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_sfUpdateOrderStatusTest.php index 2b468908be..4942a3a1c8 100644 --- a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_sfUpdateOrderStatusTest.php +++ b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_sfUpdateOrderStatusTest.php @@ -65,15 +65,15 @@ public function testSfUpdateOrderStatusオプションの引数が未指定の SC_Helper_Purchase_sfUpdateOrderStatusMock::sfUpdateOrderStatus($order_id); // 引数は最低限だけ指定 $this->expected = [ - 'order' => [ - 'status' => '3', - 'add_point' => '20', - 'use_point' => '10', - ], - 'customer' => [ - 'point' => $customer_point, - ], - ]; + 'order' => [ + 'status' => '3', + 'add_point' => '20', + 'use_point' => '10', + ], + 'customer' => [ + 'point' => $customer_point, + ], + ]; $this->actual['order'] = array_shift($this->objQuery->select( 'status, use_point, add_point', 'dtb_order', 'order_id = ?', [$order_id])); @@ -87,14 +87,11 @@ public function testSfUpdateOrderStatusオプションの引数が未指定の } // TODO 定数を変更できないためテスト不可 - /** - public function testSfUpdateOrderStatus_ポイント使用しない設定の場合_ポイントに関する処理が行われない() - { - + // public function testSfUpdateOrderStatus_ポイント使用しない設定の場合_ポイントに関する処理が行われない() + // { + // $this->verify(); + // } - $this->verify(); - } - */ public function testSfUpdateOrderStatus対応状況が発送済みに変更された場合発送日が更新される() { $order_id = $this->order_ids[0]; @@ -108,15 +105,15 @@ public function testSfUpdateOrderStatus対応状況が発送済みに変更さ SC_Helper_Purchase_sfUpdateOrderStatusMock::sfUpdateOrderStatus($order_id, ORDER_DELIV, 50, 45); $this->expected = [ - 'order' => [ - 'status' => ORDER_DELIV, - 'add_point' => '50', // 引数の設定どおりになる - 'use_point' => '45', // 引数の設定どおりになる - ], - 'customer' => [ - 'point' => $customer_point, // ポイントを使わない - ], - ]; + 'order' => [ + 'status' => ORDER_DELIV, + 'add_point' => '50', // 引数の設定どおりになる + 'use_point' => '45', // 引数の設定どおりになる + ], + 'customer' => [ + 'point' => $customer_point, // ポイントを使わない + ], + ]; $this->actual['order'] = array_shift($this->objQuery->select( 'status, use_point, add_point', 'dtb_order', 'order_id = ?', [$order_id])); @@ -145,12 +142,12 @@ public function testSfUpdateOrderStatus対応状況が入金済みに変更さ SC_Helper_Purchase_sfUpdateOrderStatusMock::sfUpdateOrderStatus($order_id, ORDER_PRE_END, 50, 45); $this->expected = [ - 'order' => [ - 'status' => ORDER_PRE_END, - 'add_point' => '50', // 引数の設定どおりになる - 'use_point' => '45', // 引数の設定どおりになる - ], - ]; + 'order' => [ + 'status' => ORDER_PRE_END, + 'add_point' => '50', // 引数の設定どおりになる + 'use_point' => '45', // 引数の設定どおりになる + ], + ]; $this->actual['order'] = array_shift($this->objQuery->select( 'status, use_point, add_point', 'dtb_order', 'order_id = ?', [$order_id])); @@ -178,15 +175,15 @@ public function testSfUpdateOrderStatus変更前の対応状況が利用対象 SC_Helper_Purchase_sfUpdateOrderStatusMock::sfUpdateOrderStatus($order_id, ORDER_CANCEL, 0, 45); $this->expected = [ - 'order' => [ - 'status' => ORDER_CANCEL, - 'add_point' => '0', // 引数の設定どおりになる - 'use_point' => '45', // 引数の設定どおりになる - ], - 'customer' => [ - 'point' => '210', // 元々200pt+10pt戻す - ], - ]; + 'order' => [ + 'status' => ORDER_CANCEL, + 'add_point' => '0', // 引数の設定どおりになる + 'use_point' => '45', // 引数の設定どおりになる + ], + 'customer' => [ + 'point' => '210', // 元々200pt+10pt戻す + ], + ]; $this->actual['order'] = array_shift($this->objQuery->select( 'status, use_point, add_point', 'dtb_order', 'order_id = ?', [$order_id])); @@ -208,15 +205,15 @@ public function testSfUpdateOrderStatus変更後の対応状況が利用対象 SC_Helper_Purchase_sfUpdateOrderStatusMock::sfUpdateOrderStatus($order_id, ORDER_NEW, 50, 45); $this->expected = [ - 'order' => [ - 'status' => ORDER_NEW, - 'add_point' => '50', // 引数の設定どおりになる - 'use_point' => '45', // 引数の設定どおりになる - ], - 'customer' => [ - 'point' => '55', // 元々100pt→45pt引く - ], - ]; + 'order' => [ + 'status' => ORDER_NEW, + 'add_point' => '50', // 引数の設定どおりになる + 'use_point' => '45', // 引数の設定どおりになる + ], + 'customer' => [ + 'point' => '55', // 元々100pt→45pt引く + ], + ]; $this->actual['order'] = array_shift($this->objQuery->select( 'status, use_point, add_point', 'dtb_order', 'order_id = ?', [$order_id])); @@ -238,15 +235,15 @@ public function testSfUpdateOrderStatus変更前の対応状況が加算対象 SC_Helper_Purchase_sfUpdateOrderStatusMock::sfUpdateOrderStatus($order_id, ORDER_CANCEL, 50, 45); $this->expected = [ - 'order' => [ - 'status' => ORDER_CANCEL, - 'add_point' => '50', // 引数の設定どおりになる - 'use_point' => '45', // 引数の設定どおりになる - ], - 'customer' => [ - 'point' => '180', // 元々200pt→20pt引く - ], - ]; + 'order' => [ + 'status' => ORDER_CANCEL, + 'add_point' => '50', // 引数の設定どおりになる + 'use_point' => '45', // 引数の設定どおりになる + ], + 'customer' => [ + 'point' => '180', // 元々200pt→20pt引く + ], + ]; $this->actual['order'] = array_shift($this->objQuery->select( 'status, use_point, add_point', 'dtb_order', 'order_id = ?', [$order_id])); @@ -268,15 +265,15 @@ public function testSfUpdateOrderStatus変更後の対応状況が加算対象 SC_Helper_Purchase_sfUpdateOrderStatusMock::sfUpdateOrderStatus($order_id, ORDER_DELIV, 50, 0); $this->expected = [ - 'order' => [ - 'status' => ORDER_DELIV, - 'add_point' => '50', // 引数の設定どおりになる - 'use_point' => '0', // 引数の設定どおりになる - ], - 'customer' => [ - 'point' => '150', // 元々100pt→50pt足す - ], - ]; + 'order' => [ + 'status' => ORDER_DELIV, + 'add_point' => '50', // 引数の設定どおりになる + 'use_point' => '0', // 引数の設定どおりになる + ], + 'customer' => [ + 'point' => '150', // 元々100pt→50pt足す + ], + ]; $this->actual['order'] = array_shift($this->objQuery->select( 'status, use_point, add_point', 'dtb_order', 'order_id = ?', [$order_id])); @@ -298,15 +295,15 @@ public function testSfUpdateOrderStatus加算ポイントがプラスの場合 SC_Helper_Purchase_sfUpdateOrderStatusMock::sfUpdateOrderStatus($order_id, ORDER_PRE_END, 40, 25); $this->expected = [ - 'order' => [ - 'status' => ORDER_PRE_END, - 'add_point' => '40', // 引数の設定どおりになる - 'use_point' => '25', // 引数の設定どおりになる - ], - 'customer' => [ - 'point' => '105', // 変更前の状態で-10pt,変更後の状態で+15pt - ], - ]; + 'order' => [ + 'status' => ORDER_PRE_END, + 'add_point' => '40', // 引数の設定どおりになる + 'use_point' => '25', // 引数の設定どおりになる + ], + 'customer' => [ + 'point' => '105', // 変更前の状態で-10pt,変更後の状態で+15pt + ], + ]; $this->actual['order'] = array_shift($this->objQuery->select( 'status, use_point, add_point', 'dtb_order', 'order_id = ?', [$order_id])); @@ -328,15 +325,15 @@ public function testSfUpdateOrderStatus加算ポイントが負でポイント SC_Helper_Purchase_sfUpdateOrderStatusMock::sfUpdateOrderStatus($order_id, ORDER_PRE_END, 0, 50); $this->expected = [ - 'order' => [ - 'status' => ORDER_PRE_END, - 'add_point' => '0', // 引数の設定どおりになる - 'use_point' => '50', // 引数の設定どおりになる - ], - 'customer' => [ - 'point' => '40', // 変更前の状態で-10pt,変更後の状態で-50pt - ], - ]; + 'order' => [ + 'status' => ORDER_PRE_END, + 'add_point' => '0', // 引数の設定どおりになる + 'use_point' => '50', // 引数の設定どおりになる + ], + 'customer' => [ + 'point' => '40', // 変更前の状態で-10pt,変更後の状態で-50pt + ], + ]; $this->actual['order'] = array_shift($this->objQuery->select( 'status, use_point, add_point', 'dtb_order', 'order_id = ?', [$order_id])); @@ -346,11 +343,9 @@ public function testSfUpdateOrderStatus加算ポイントが負でポイント } // TODO ロールバックされる場合はexitするためテスト不可. - /** - public function testSfUpdateOrderStatus_加算ポイントが負でポイントが足りていない場合_会員テーブルがロールバックされエラーとなる() - { - } - */ + // public function testSfUpdateOrderStatus_加算ポイントが負でポイントが足りていない場合_会員テーブルがロールバックされエラーとなる() + // { + // } // //////////////////////////////////////// diff --git a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_unsetOneShippingTest.php b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_unsetOneShippingTest.php index 012e8c7ca8..3aabc14752 100644 --- a/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_unsetOneShippingTest.php +++ b/tests/class/helper/SC_Helper_Purchase/SC_Helper_Purchase_unsetOneShippingTest.php @@ -51,15 +51,15 @@ public function testUnsetOneShippingTemp指定したIDの配送情報のみが SC_Helper_Purchase::unsetOneShippingTemp('00002'); $this->expected = [ - '00001' => [ - 'shipment_id' => '00001', - 'shipment_item' => ['商品1'], - 'shipping_pref' => '東京都', ], - '00003' => [ - 'shipment_id' => '00003', - 'shipment_item' => [], - 'shipping_pref' => '埼玉県', ], - ]; + '00001' => [ + 'shipment_id' => '00001', + 'shipment_item' => ['商品1'], + 'shipping_pref' => '東京都', ], + '00003' => [ + 'shipment_id' => '00003', + 'shipment_item' => [], + 'shipping_pref' => '埼玉県', ], + ]; $this->actual = $_SESSION['shipping']; $this->verify('配送情報'); diff --git a/tests/class/helper/SC_Helper_TaxRule/SC_Helper_TaxRule_getTaxDetailTest.php b/tests/class/helper/SC_Helper_TaxRule/SC_Helper_TaxRule_getTaxDetailTest.php index f9b0adbdce..2df59906d5 100644 --- a/tests/class/helper/SC_Helper_TaxRule/SC_Helper_TaxRule_getTaxDetailTest.php +++ b/tests/class/helper/SC_Helper_TaxRule/SC_Helper_TaxRule_getTaxDetailTest.php @@ -112,6 +112,7 @@ public function testGetTaxPerTaxRateWithZero() /** * @runInSeparateProcess + * * @preserveGlobalState disabled */ public function testGetTaxPerTaxRateWithFloor() @@ -161,6 +162,7 @@ public function testGetTaxPerTaxRateWithFloor() /** * @runInSeparateProcess + * * @preserveGlobalState disabled */ public function testGetTaxPerTaxRateWithCeil() @@ -262,7 +264,9 @@ public function testGetTaxPerTaxRateWithRound2() /** * @see https://github.com/EC-CUBE/ec-cube2/pull/762#issuecomment-1897799676 + * * @runInSeparateProcess + * * @preserveGlobalState disabled */ public function testGetTaxPerTaxRateWithFloor2() @@ -312,7 +316,9 @@ public function testGetTaxPerTaxRateWithFloor2() /** * @see https://github.com/EC-CUBE/ec-cube2/pull/762#issuecomment-1897799676 + * * @runInSeparateProcess + * * @preserveGlobalState disabled */ public function testGetTaxPerTaxRateWithCeil2() diff --git a/tests/class/helper/SC_Helper_TaxRule/SC_Helper_TaxRule_getTaxRuleTest.php b/tests/class/helper/SC_Helper_TaxRule/SC_Helper_TaxRule_getTaxRuleTest.php index fb3747f3be..b4bdf59fcc 100644 --- a/tests/class/helper/SC_Helper_TaxRule/SC_Helper_TaxRule_getTaxRuleTest.php +++ b/tests/class/helper/SC_Helper_TaxRule/SC_Helper_TaxRule_getTaxRuleTest.php @@ -23,6 +23,7 @@ protected function tearDown(): void /** * @runInSeparateProcess + * * @preserveGlobalState disabled */ public function test定数が正しく設定されているかのテスト() @@ -34,6 +35,7 @@ public function test定数が正しく設定されているかのテスト() /** * @runInSeparateProcess + * * @preserveGlobalState disabled */ public function test引数が空の場合税率設定で設定かつ適用日時内の最新の値が返される() @@ -60,6 +62,7 @@ public function test引数が空の場合税率設定で設定かつ適用日時 /** * @runInSeparateProcess + * * @preserveGlobalState disabled */ public function test商品idを指定した場合税率設定で設定かつ適用日時内の最新の値が返される() @@ -86,6 +89,7 @@ public function test商品idを指定した場合税率設定で設定かつ適 /** * @runInSeparateProcess + * * @preserveGlobalState disabled */ public function test商品規格idを指定した場合税率設定で設定かつ適用日時内の最新の値が返される() diff --git a/tests/class/helper/SC_Helper_TaxRule/SC_Helper_TaxRule_getTaxRule_OptionProductTaxRuleTest.php b/tests/class/helper/SC_Helper_TaxRule/SC_Helper_TaxRule_getTaxRule_OptionProductTaxRuleTest.php index c244d302ed..e7c0bfd0d0 100644 --- a/tests/class/helper/SC_Helper_TaxRule/SC_Helper_TaxRule_getTaxRule_OptionProductTaxRuleTest.php +++ b/tests/class/helper/SC_Helper_TaxRule/SC_Helper_TaxRule_getTaxRule_OptionProductTaxRuleTest.php @@ -25,6 +25,7 @@ protected function tearDown(): void /** * @runInSeparateProcess + * * @preserveGlobalState disabled */ public function test引数が空の場合税率設定で設定かつ適用日時内の最新の値が返される() @@ -51,6 +52,7 @@ public function test引数が空の場合税率設定で設定かつ適用日時 /** * @runInSeparateProcess + * * @preserveGlobalState disabled */ public function test商品idを指定した場合商品に設定かつ適用日時内の最新の値が返される() @@ -77,6 +79,7 @@ public function test商品idを指定した場合商品に設定かつ適用日 /** * @runInSeparateProcess + * * @preserveGlobalState disabled */ public function test商品規格idを指定した場合商品に登録かつ適用日時内の最新の値が返される() @@ -103,6 +106,7 @@ public function test商品規格idを指定した場合商品に登録かつ適 /** * @runInSeparateProcess + * * @preserveGlobalState disabled */ public function test商品規格idのみを指定した場合税率設定に登録かつ適用日時内の最新の値が返される() @@ -129,6 +133,7 @@ public function test商品規格idのみを指定した場合税率設定に登 /** * @runInSeparateProcess + * * @preserveGlobalState disabled * * 基本税率と同じ税率を設定すると商品別税率を削除する diff --git a/tests/class/plugin/LoadClassFileChangeCustomDirTest.php b/tests/class/plugin/LoadClassFileChangeCustomDirTest.php index 44788e3a83..f89cbe007c 100644 --- a/tests/class/plugin/LoadClassFileChangeCustomDirTest.php +++ b/tests/class/plugin/LoadClassFileChangeCustomDirTest.php @@ -37,6 +37,7 @@ protected function setUp(): void /** * @runInSeparateProcess + * * @preserveGlobalState disabled */ public function testLOading() diff --git a/tests/class/plugin/LoadClassFileChangeTest.php b/tests/class/plugin/LoadClassFileChangeTest.php index da09c22c02..174c33d66f 100644 --- a/tests/class/plugin/LoadClassFileChangeTest.php +++ b/tests/class/plugin/LoadClassFileChangeTest.php @@ -38,6 +38,7 @@ protected function tearDown(): void * loadClassFileChange で拡張したクラスのテストケース. * * @runInSeparateProcess + * * @preserveGlobalState disabled */ public function testLoadExtendedClass() diff --git a/tests/class/util/SC_Utils/SC_Utils_arrayDefineIndexesTest.php b/tests/class/util/SC_Utils/SC_Utils_arrayDefineIndexesTest.php index 73ea917125..1b26ab6313 100644 --- a/tests/class/util/SC_Utils/SC_Utils_arrayDefineIndexesTest.php +++ b/tests/class/util/SC_Utils/SC_Utils_arrayDefineIndexesTest.php @@ -61,12 +61,12 @@ public function testArrayDefineIndexesチェック対象のキーが一部存在 $defineIndexes = ['tomato', 'banana', 'kiwi']; $this->expected = [ - 'apple' => 'りんご', - 'banana' => 'バナナ', - 'orange' => 'オレンジ', - 'tomato' => '', - 'kiwi' => '', - ]; + 'apple' => 'りんご', + 'banana' => 'バナナ', + 'orange' => 'オレンジ', + 'tomato' => '', + 'kiwi' => '', + ]; $this->actual = SC_Utils::arrayDefineIndexes($input_array, $defineIndexes); $this->verify(); diff --git a/tests/class/util/SC_Utils/SC_Utils_isAbsoluteRealPathTest.php b/tests/class/util/SC_Utils/SC_Utils_isAbsoluteRealPathTest.php index 147023471c..d178f1323a 100644 --- a/tests/class/util/SC_Utils/SC_Utils_isAbsoluteRealPathTest.php +++ b/tests/class/util/SC_Utils/SC_Utils_isAbsoluteRealPathTest.php @@ -47,7 +47,7 @@ protected function tearDown(): void // /////////////////////////////////////// public function testIsAbsoluteRealPath絶対パスの場合Trueが返る() { - if (strpos(PHP_OS, 'WIN') !== false) { + if (str_contains(PHP_OS, 'WIN')) { $input = 'C:/Program Files/username/hoge/hoge.txt'; $this->markTestSkipped( 'Appveyorが落ちるので暫定スキップしています' @@ -63,7 +63,7 @@ public function testIsAbsoluteRealPath絶対パスの場合Trueが返る() public function testIsAbsoluteRealPath相対パスの場合Trueが返る() { - if (strpos(PHP_OS, 'WIN') !== false) { + if (str_contains(PHP_OS, 'WIN')) { $input = './system32/hoge/hoge.txt'; } else { $input = '../etc/php.ini'; diff --git a/tests/class/util/SC_Utils/SC_Utils_isAppInnerUrlTest.php b/tests/class/util/SC_Utils/SC_Utils_isAppInnerUrlTest.php index 114b1fd81b..edcb14a868 100644 --- a/tests/class/util/SC_Utils/SC_Utils_isAppInnerUrlTest.php +++ b/tests/class/util/SC_Utils/SC_Utils_isAppInnerUrlTest.php @@ -48,43 +48,41 @@ protected function tearDown(): void } // /////////////////////////////////////// - /** - public function testIsAppInnerUrl_非SSLかつアプリ内URLの場合_trueが返る() - { - $input = 'http://sample.eccube.jp/admin/'; - $this->expected = true; - $this->actual = SC_Utils::isAppInnerUrl($input); + // public function testIsAppInnerUrl_非SSLかつアプリ内URLの場合_trueが返る() + // { + // $input = 'http://sample.eccube.jp/admin/'; + // $this->expected = true; + // $this->actual = SC_Utils::isAppInnerUrl($input); - $this->verify(); - } + // $this->verify(); + // } - public function testIsAppInnerUrl_非SSLかつアプリ外URLの場合_falseが返る() - { - $input = 'http://outside.eccube.jp/admin/'; - $this->expected = false; - $this->actual = SC_Utils::isAppInnerUrl($input); + // public function testIsAppInnerUrl_非SSLかつアプリ外URLの場合_falseが返る() + // { + // $input = 'http://outside.eccube.jp/admin/'; + // $this->expected = false; + // $this->actual = SC_Utils::isAppInnerUrl($input); - $this->verify(); - } + // $this->verify(); + // } - public function testIsAppInnerUrl_SSLかつアプリ内URLの場合_trueが返る() - { - $input = 'https://sample.eccube.jp/admin/'; - $this->expected = true; - $this->actual = SC_Utils::isAppInnerUrl($input); + // public function testIsAppInnerUrl_SSLかつアプリ内URLの場合_trueが返る() + // { + // $input = 'https://sample.eccube.jp/admin/'; + // $this->expected = true; + // $this->actual = SC_Utils::isAppInnerUrl($input); - $this->verify(); - } + // $this->verify(); + // } - public function testIsAppInnerUrl_SSLかつアプリ外URLの場合_falseが返る() - { - $input = 'https://outside.eccube.jp/admin/'; - $this->expected = false; - $this->actual = SC_Utils::isAppInnerUrl($input); + // public function testIsAppInnerUrl_SSLかつアプリ外URLの場合_falseが返る() + // { + // $input = 'https://outside.eccube.jp/admin/'; + // $this->expected = false; + // $this->actual = SC_Utils::isAppInnerUrl($input); - $this->verify(); - } - */ + // $this->verify(); + // } // //////////////////////////////////////// public function testDummyTest() diff --git a/tests/class/util/SC_Utils/SC_Utils_sfArrCombineTest.php b/tests/class/util/SC_Utils/SC_Utils_sfArrCombineTest.php index 4c3cc6be3e..42fd0f284d 100644 --- a/tests/class/util/SC_Utils/SC_Utils_sfArrCombineTest.php +++ b/tests/class/util/SC_Utils/SC_Utils_sfArrCombineTest.php @@ -62,10 +62,10 @@ public function testSfArrCombine入力のキー配列の方が短い場合余っ $values = ['りんご', 'バナナ', 'オレンジ', '梨']; $this->expected = [ - 'apple' => 'りんご', - 'banana' => 'バナナ', - null => '梨', - ]; + 'apple' => 'りんご', + 'banana' => 'バナナ', + null => '梨', + ]; $this->actual = SC_Utils::sfArrCombine($keys, $values); $this->verify(); @@ -77,11 +77,11 @@ public function testSfArrCombine入力のキー配列の方が長い場合余っ $values = ['りんご', 'バナナ']; $this->expected = [ - 'apple' => 'りんご', - 'banana' => 'バナナ', - 'orange' => null, - 'pear' => null, - ]; + 'apple' => 'りんご', + 'banana' => 'バナナ', + 'orange' => null, + 'pear' => null, + ]; $this->actual = SC_Utils::sfArrCombine($keys, $values); $this->verify(); diff --git a/tests/class/util/SC_Utils/SC_Utils_sfArrKeyValueTest.php b/tests/class/util/SC_Utils/SC_Utils_sfArrKeyValueTest.php index 13a4ca0653..fbcde121a7 100644 --- a/tests/class/util/SC_Utils/SC_Utils_sfArrKeyValueTest.php +++ b/tests/class/util/SC_Utils/SC_Utils_sfArrKeyValueTest.php @@ -42,11 +42,11 @@ protected function setUp(): void // parent::setUp(); $this->arrList = [ - ['testkey' => '1011', 'testvalue' => '2001', 'key' => '3001'], - ['testkey' => '2022', 'testvalue' => '2002', 'key' => '3002'], - ['testkey' => '3033', 'testvalue' => '2003', 'key' => '3003'], - ['testkey' => '4044', 'testvalue' => '2004', 'key' => '3004'], - ]; + ['testkey' => '1011', 'testvalue' => '2001', 'key' => '3001'], + ['testkey' => '2022', 'testvalue' => '2002', 'key' => '3002'], + ['testkey' => '3033', 'testvalue' => '2003', 'key' => '3003'], + ['testkey' => '4044', 'testvalue' => '2004', 'key' => '3004'], + ]; $this->keyname = 'testkey'; $this->valuename = 'testvalue'; } @@ -62,10 +62,10 @@ public function testSfArrKeyValue最大長が配列より短い場合最大長 $len_max = 3; $this->expected = [ - '1011' => '2001', - '2022' => '2002', - '3033' => '2003', - ]; + '1011' => '2001', + '2022' => '2002', + '3033' => '2003', + ]; $this->actual = SC_Utils::sfArrKeyValue($this->arrList, $this->keyname, $this->valuename, $len_max); $this->verify(); @@ -74,11 +74,11 @@ public function testSfArrKeyValue最大長が配列より短い場合最大長 public function testSfArrKeyValue最大長が指定されていない場合全要素が出力される() { $this->expected = [ - '1011' => '2001', - '2022' => '2002', - '3033' => '2003', - '4044' => '2004', - ]; + '1011' => '2001', + '2022' => '2002', + '3033' => '2003', + '4044' => '2004', + ]; $this->actual = SC_Utils::sfArrKeyValue($this->arrList, $this->keyname, $this->valuename, $len_max); $this->verify(); @@ -90,11 +90,11 @@ public function testSfArrKeyValueキーサイズが短い場合キーサイズ $keysize = 1; $this->expected = [ - '1...' => '2001', - '2...' => '2002', - '3...' => '2003', - '4...' => '2004', - ]; + '1...' => '2001', + '2...' => '2002', + '3...' => '2003', + '4...' => '2004', + ]; $this->actual = SC_Utils::sfArrKeyValue($this->arrList, $this->keyname, $this->valuename, $len_max, $keysize); $this->verify(); diff --git a/tests/class/util/SC_Utils/SC_Utils_sfCopyDirtest.php b/tests/class/util/SC_Utils/SC_Utils_sfCopyDirtest.php index 1d6c1389a6..8e509c9f18 100644 --- a/tests/class/util/SC_Utils/SC_Utils_sfCopyDirtest.php +++ b/tests/class/util/SC_Utils/SC_Utils_sfCopyDirtest.php @@ -60,9 +60,9 @@ public function testSfCopyDirディレクトリでない場合Falseを返し何 $dst = self::$TMP_DIR.'/dst/'; $this->expected = [ - 'result' => false, - 'file_exists' => false, - ]; + 'result' => false, + 'file_exists' => false, + ]; $this->actual['result'] = SC_Utils::sfCopyDir($src, $dst); $this->actual['file_exists'] = file_exists($dst); @@ -80,9 +80,9 @@ public function testSfCopyDirコピー先のディレクトリが存在しない $dst = self::$TMP_DIR.'/dst/'; $this->expected = [ - 'dir_exists' => true, - 'files' => ['test.txt'], - ]; + 'dir_exists' => true, + 'files' => ['test.txt'], + ]; SC_Utils::sfCopyDir($src, $dst); $this->actual['dir_exists'] = is_dir($dst); $this->actual['files'] = Test_Utils::mapCols(SC_Helper_FileManager::sfGetFileList($dst), 'file_name'); @@ -117,12 +117,12 @@ public function testSfCopyDirコピー先のディレクトリが存在する場 $dst = self::$TMP_DIR.'/dst/'; $this->expected = [ - 'dir_exists' => true, - 'files' => ['CVS', 'dir1', 'test.txt'], - 'files_2' => ['dir12'], - 'files_3' => ['dir123'], - 'file_content' => 'good morning', - ]; + 'dir_exists' => true, + 'files' => ['CVS', 'dir1', 'test.txt'], + 'files_2' => ['dir12'], + 'files_3' => ['dir123'], + 'file_content' => 'good morning', + ]; SC_Utils::sfCopyDir($src, $dst); $this->actual['dir_exists'] = is_dir($dst); $this->actual['files'] = Test_Utils::mapCols(SC_Helper_FileManager::sfGetFileList($dst), 'file_name'); @@ -151,10 +151,10 @@ public function testSfCopyDir上書きフラグがONの場合同名ファイル $dst = self::$TMP_DIR.'/dst/'; $this->expected = [ - 'dir_exists' => true, - 'files' => ['test.txt'], - 'file_content' => 'hello', - ]; + 'dir_exists' => true, + 'files' => ['test.txt'], + 'file_content' => 'hello', + ]; SC_Utils::sfCopyDir($src, $dst, '', true); $this->actual['dir_exists'] = is_dir($dst); $this->actual['files'] = Test_Utils::mapCols(SC_Helper_FileManager::sfGetFileList($dst), 'file_name'); @@ -183,10 +183,10 @@ public function testSfCopyDir上書きフラグがONかつ書き込み権限が $dst = self::$TMP_DIR.'/dst/'; $this->expected = [ - 'dir_exists' => true, - 'files' => ['test.txt'], - 'file_content' => 'good morning', - ]; + 'dir_exists' => true, + 'files' => ['test.txt'], + 'file_content' => 'good morning', + ]; SC_Utils::sfCopyDir($src, $dst, '', true); $this->actual['dir_exists'] = is_dir($dst); $this->actual['files'] = Test_Utils::mapCols(SC_Helper_FileManager::sfGetFileList($dst), 'file_name'); diff --git a/tests/class/util/SC_Utils/SC_Utils_sfEncodeFileTest.php b/tests/class/util/SC_Utils/SC_Utils_sfEncodeFileTest.php index ff9a464821..19006419e1 100644 --- a/tests/class/util/SC_Utils/SC_Utils_sfEncodeFileTest.php +++ b/tests/class/util/SC_Utils/SC_Utils_sfEncodeFileTest.php @@ -60,9 +60,9 @@ public function testSfEncodeFileファイルが正常に開けた場合ファイ fclose($fp_out); $this->expected = [ - 'filename' => $outdir.'enc_test.txt', - 'content' => 'こんにちは', - ]; + 'filename' => $outdir.'enc_test.txt', + 'content' => 'こんにちは', + ]; $this->actual['filename'] = SC_Utils::sfEncodeFile($filepath, 'euc-jp', $outdir); @@ -75,5 +75,5 @@ public function testSfEncodeFileファイルが正常に開けた場合ファイ // TODO ファイルが開けなかった場合はexitするためテスト不可 - // //////////////////////////////////////// + // //////////////////////////////////////// } diff --git a/tests/class/util/SC_Utils/SC_Utils_sfGetAddressTest.php b/tests/class/util/SC_Utils/SC_Utils_sfGetAddressTest.php index 6d34029bd4..7a5aaadf94 100644 --- a/tests/class/util/SC_Utils/SC_Utils_sfGetAddressTest.php +++ b/tests/class/util/SC_Utils/SC_Utils_sfGetAddressTest.php @@ -58,12 +58,12 @@ public function test住所がヒットしない場合空の配列が返る() public function test住所が一件だけヒットする場合住所データが取得できる() { $this->expected = [ - [ - 'state' => '1', // 北海道 - 'city' => '札幌市中央区', - 'town' => '大通東', - ], - ]; + [ + 'state' => '1', // 北海道 + 'city' => '札幌市中央区', + 'town' => '大通東', + ], + ]; $this->actual = SC_Utils::sfGetAddress('0600041'); $this->verify('郵便番号検索結果'); @@ -72,35 +72,34 @@ public function test住所が一件だけヒットする場合住所データが // TODO 二件目に関しては件名のIDへの変換と町名の削除が行われない。 // 今の仕様ではこれでOKかもしれないが、そもそも一件目しか使わないのなら // $data_list[0]を返した方が良いのでは? - /** - public function test_住所が二件以上ヒットする場合_町名を消した住所データが取得できる() - { - $this->expected = array( - array( - 'state' => '5', // 秋田県 - 'city' => '秋田市', - 'town' => '' - ), - array( - 'state' => '5', - 'city' => '秋田市', - 'town' => '' - ) - ); - $this->actual = SC_Utils::sfGetAddress('0110951'); - - $this->verify('郵便番号検索結果'); - } - */ + // public function test_住所が二件以上ヒットする場合_町名を消した住所データが取得できる() + // { + // $this->expected = array( + // array( + // 'state' => '5', // 秋田県 + // 'city' => '秋田市', + // 'town' => '' + // ), + // array( + // 'state' => '5', + // 'city' => '秋田市', + // 'town' => '' + // ) + // ); + // $this->actual = SC_Utils::sfGetAddress('0110951'); + // + // $this->verify('郵便番号検索結果'); + // } + public function test住所に但し書きが含まれる場合但し書きが消去される() { $this->expected = [ - [ - 'state' => '1', // 北海道 - 'city' => '札幌市中央区', - 'town' => '大通西', - ], - ]; + [ + 'state' => '1', // 北海道 + 'city' => '札幌市中央区', + 'town' => '大通西', + ], + ]; $this->actual = SC_Utils::sfGetAddress('0600042'); $this->verify('郵便番号検索結果'); @@ -109,12 +108,12 @@ public function test住所に但し書きが含まれる場合但し書きが消 public function test住所に注意文言がある場合町名が消去される() { $this->expected = [ - [ - 'state' => '1', // 北海道 - 'city' => '札幌市中央区', - 'town' => '', - ], - ]; + [ + 'state' => '1', // 北海道 + 'city' => '札幌市中央区', + 'town' => '', + ], + ]; $this->actual = SC_Utils::sfGetAddress('0600000'); $this->verify('郵便番号検索結果'); @@ -123,12 +122,12 @@ public function test住所に注意文言がある場合町名が消去される public function test住所に番地の説明が含まれる場合町名が消去される() { $this->expected = [ - [ - 'state' => '8', // 茨城県 - 'city' => '猿島郡堺町', - 'town' => '', - ], - ]; + [ + 'state' => '8', // 茨城県 + 'city' => '猿島郡堺町', + 'town' => '', + ], + ]; $this->actual = SC_Utils::sfGetAddress('3060433'); $this->verify('郵便番号検索結果'); @@ -139,49 +138,49 @@ public function test住所に番地の説明が含まれる場合町名が消去 protected function setUpAddress() { $address = [ - [ - 'zip_id' => '2', - 'zipcode' => '0600041', - 'state' => '北海道', - 'city' => '札幌市中央区', - 'town' => '大通東', - ], - [ - 'zip_id' => '3', - 'zipcode' => '0600042', - 'state' => '北海道', - 'city' => '札幌市中央区', - 'town' => '大通西(1〜19丁目)', - ], - [ - 'zip_id' => '0', - 'zipcode' => '0600000', - 'state' => '北海道', - 'city' => '札幌市中央区', - 'town' => '以下に掲載がない場合', - ], - [ - 'zip_id' => '26867', - 'zipcode' => '3060433', - 'state' => '茨城県', - 'city' => '猿島郡堺町', - 'town' => '堺町の次に番地がくる場合', - ], - [ - 'zip_id' => '16223', - 'zipcode' => '0110951', - 'state' => '秋田県', - 'city' => '秋田市', - 'town' => '土崎港相染町', - ], - [ - 'zip_id' => '16226', - 'zipcode' => '0110951', - 'state' => '秋田県', - 'city' => '秋田市', - 'town' => '土崎港古川町', - ], - ]; + [ + 'zip_id' => '2', + 'zipcode' => '0600041', + 'state' => '北海道', + 'city' => '札幌市中央区', + 'town' => '大通東', + ], + [ + 'zip_id' => '3', + 'zipcode' => '0600042', + 'state' => '北海道', + 'city' => '札幌市中央区', + 'town' => '大通西(1〜19丁目)', + ], + [ + 'zip_id' => '0', + 'zipcode' => '0600000', + 'state' => '北海道', + 'city' => '札幌市中央区', + 'town' => '以下に掲載がない場合', + ], + [ + 'zip_id' => '26867', + 'zipcode' => '3060433', + 'state' => '茨城県', + 'city' => '猿島郡堺町', + 'town' => '堺町の次に番地がくる場合', + ], + [ + 'zip_id' => '16223', + 'zipcode' => '0110951', + 'state' => '秋田県', + 'city' => '秋田市', + 'town' => '土崎港相染町', + ], + [ + 'zip_id' => '16226', + 'zipcode' => '0110951', + 'state' => '秋田県', + 'city' => '秋田市', + 'town' => '土崎港古川町', + ], + ]; $this->objQuery->delete('mtb_zip'); foreach ($address as $item) { diff --git a/tests/class/util/SC_Utils/SC_Utils_sfGetClassCatCountTest.php b/tests/class/util/SC_Utils/SC_Utils_sfGetClassCatCountTest.php index 977cc444e3..b77413e274 100644 --- a/tests/class/util/SC_Utils/SC_Utils_sfGetClassCatCountTest.php +++ b/tests/class/util/SC_Utils/SC_Utils_sfGetClassCatCountTest.php @@ -50,9 +50,9 @@ protected function tearDown(): void public function testSfGetClassCatCount規格分類の件数がIDごとに取得できる() { $this->expected = [ - '1001' => '2', - '1002' => '1', - ]; + '1001' => '2', + '1002' => '1', + ]; $this->actual = SC_Utils::sfGetClassCatCount(); $this->verify('規格分類の件数'); @@ -63,69 +63,69 @@ public function testSfGetClassCatCount規格分類の件数がIDごとに取得 protected function setUpClassCat() { $classes = [ - [ - 'class_id' => '1001', - 'name' => '味', - 'creator_id' => '1', - 'update_date' => 'CURRENT_TIMESTAMP', - 'del_flg' => '0', - ], - [ - 'class_id' => '1002', - 'name' => '大きさ', - 'creator_id' => '1', - 'update_date' => 'CURRENT_TIMESTAMP', - 'del_flg' => '0', - ], - // 削除フラグが立っているので検索されない - [ - 'class_id' => '1003', - 'name' => '匂い', - 'creator_id' => '1', - 'update_date' => 'CURRENT_TIMESTAMP', - 'del_flg' => '1', - ], - ]; + [ + 'class_id' => '1001', + 'name' => '味', + 'creator_id' => '1', + 'update_date' => 'CURRENT_TIMESTAMP', + 'del_flg' => '0', + ], + [ + 'class_id' => '1002', + 'name' => '大きさ', + 'creator_id' => '1', + 'update_date' => 'CURRENT_TIMESTAMP', + 'del_flg' => '0', + ], + // 削除フラグが立っているので検索されない + [ + 'class_id' => '1003', + 'name' => '匂い', + 'creator_id' => '1', + 'update_date' => 'CURRENT_TIMESTAMP', + 'del_flg' => '1', + ], + ]; $this->objQuery->delete('dtb_class'); foreach ($classes as $item) { $this->objQuery->insert('dtb_class', $item); } $class_categories = [ - [ - 'classcategory_id' => '1011', - 'class_id' => '1001', - 'creator_id' => '1', - 'update_date' => 'CURRENT_TIMESTAMP', - ], - // 削除フラグが立っているので検索されない - [ - 'classcategory_id' => '1012', - 'class_id' => '1001', - 'creator_id' => '1', - 'update_date' => 'CURRENT_TIMESTAMP', - 'del_flg' => '1', - ], - [ - 'classcategory_id' => '1013', - 'class_id' => '1001', - 'creator_id' => '1', - 'update_date' => 'CURRENT_TIMESTAMP', - ], - [ - 'classcategory_id' => '1021', - 'class_id' => '1002', - 'creator_id' => '1', - 'update_date' => 'CURRENT_TIMESTAMP', - ], - // dtb_classでdel_flgが立っているので検索されない - [ - 'classcategory_id' => '1031', - 'class_id' => '1003', - 'creator_id' => '1', - 'update_date' => 'CURRENT_TIMESTAMP', - ], - ]; + [ + 'classcategory_id' => '1011', + 'class_id' => '1001', + 'creator_id' => '1', + 'update_date' => 'CURRENT_TIMESTAMP', + ], + // 削除フラグが立っているので検索されない + [ + 'classcategory_id' => '1012', + 'class_id' => '1001', + 'creator_id' => '1', + 'update_date' => 'CURRENT_TIMESTAMP', + 'del_flg' => '1', + ], + [ + 'classcategory_id' => '1013', + 'class_id' => '1001', + 'creator_id' => '1', + 'update_date' => 'CURRENT_TIMESTAMP', + ], + [ + 'classcategory_id' => '1021', + 'class_id' => '1002', + 'creator_id' => '1', + 'update_date' => 'CURRENT_TIMESTAMP', + ], + // dtb_classでdel_flgが立っているので検索されない + [ + 'classcategory_id' => '1031', + 'class_id' => '1003', + 'creator_id' => '1', + 'update_date' => 'CURRENT_TIMESTAMP', + ], + ]; // classcategory_id=0のものは削除しない $this->objQuery->delete('dtb_classcategory', 'classcategory_id <> 0'); foreach ($class_categories as $item) { diff --git a/tests/class/util/SC_Utils/SC_Utils_sfGetHashString_authTypePlainTest.php b/tests/class/util/SC_Utils/SC_Utils_sfGetHashString_authTypePlainTest.php index 6016bc39ce..8ee6559ec5 100644 --- a/tests/class/util/SC_Utils/SC_Utils_sfGetHashString_authTypePlainTest.php +++ b/tests/class/util/SC_Utils/SC_Utils_sfGetHashString_authTypePlainTest.php @@ -47,17 +47,16 @@ protected function tearDown(): void } // /////////////////////////////////////// - /** - public function testSfGetHashString_暗号化なしの設定になっている場合_文字列が変換されない() - { - $input = 'hello, world'; + // public function testSfGetHashString_暗号化なしの設定になっている場合_文字列が変換されない() + // { + // $input = 'hello, world'; - $this->expected = $input; - $this->actual = SC_Utils::sfGetHashString($input); + // $this->expected = $input; + // $this->actual = SC_Utils::sfGetHashString($input); + + // $this->verify(); + // } - $this->verify(); - } - */ public function testDummyTest() { // Warning が出るため空のテストを作成 diff --git a/tests/class/util/SC_Utils/SC_Utils_sfGetProductClassIdTest.php b/tests/class/util/SC_Utils/SC_Utils_sfGetProductClassIdTest.php index 79038e5061..5d7216c6e3 100644 --- a/tests/class/util/SC_Utils/SC_Utils_sfGetProductClassIdTest.php +++ b/tests/class/util/SC_Utils/SC_Utils_sfGetProductClassIdTest.php @@ -93,33 +93,33 @@ public function testSfGetProductClassId存在しない製品IDを指定した場 protected function setUpProductsClass() { $products_class = [ - [ - 'product_class_id' => '2001', - 'product_id' => '2001', - 'product_code' => 'code2001', - 'price02' => '1000', - 'creator_id' => '1', - 'update_date' => 'CURRENT_TIMESTAMP', - ], - [ - 'product_class_id' => '1001', - 'product_id' => '1001', - 'product_code' => 'code1001', - 'price02' => '1000', - 'classcategory_id1' => '1', - 'creator_id' => '1', - 'update_date' => 'CURRENT_TIMESTAMP', - ], - [ - 'product_class_id' => '1002', - 'product_id' => '1001', - 'product_code' => 'code1002', - 'price02' => '1000', - 'classcategory_id1' => '2', - 'creator_id' => '1', - 'update_date' => 'CURRENT_TIMESTAMP', - ], - ]; + [ + 'product_class_id' => '2001', + 'product_id' => '2001', + 'product_code' => 'code2001', + 'price02' => '1000', + 'creator_id' => '1', + 'update_date' => 'CURRENT_TIMESTAMP', + ], + [ + 'product_class_id' => '1001', + 'product_id' => '1001', + 'product_code' => 'code1001', + 'price02' => '1000', + 'classcategory_id1' => '1', + 'creator_id' => '1', + 'update_date' => 'CURRENT_TIMESTAMP', + ], + [ + 'product_class_id' => '1002', + 'product_id' => '1001', + 'product_code' => 'code1002', + 'price02' => '1000', + 'classcategory_id1' => '2', + 'creator_id' => '1', + 'update_date' => 'CURRENT_TIMESTAMP', + ], + ]; $this->objQuery->delete('dtb_products_class'); foreach ($products_class as $item) { diff --git a/tests/class/util/SC_Utils/SC_Utils_sfGetUnderChildrenArrayTest.php b/tests/class/util/SC_Utils/SC_Utils_sfGetUnderChildrenArrayTest.php index 20d0b01b43..a088a194c3 100644 --- a/tests/class/util/SC_Utils/SC_Utils_sfGetUnderChildrenArrayTest.php +++ b/tests/class/util/SC_Utils/SC_Utils_sfGetUnderChildrenArrayTest.php @@ -47,12 +47,12 @@ protected function tearDown(): void public function testSfGetUnderChildrenArray与えられた親IDを持つ要素だけが抽出される() { $input_array = [ - ['parent_id' => '1001', 'child_id' => '1001001'], - ['parent_id' => '1002', 'child_id' => '1002001'], - ['parent_id' => '1002', 'child_id' => '1002002'], - ['parent_id' => '1003', 'child_id' => '1003001'], - ['parent_id' => '1004', 'child_id' => '1004001'], - ]; + ['parent_id' => '1001', 'child_id' => '1001001'], + ['parent_id' => '1002', 'child_id' => '1002001'], + ['parent_id' => '1002', 'child_id' => '1002002'], + ['parent_id' => '1003', 'child_id' => '1003001'], + ['parent_id' => '1004', 'child_id' => '1004001'], + ]; $this->expected = ['1002001', '1002002']; $this->actual = SC_Utils::sfGetUnderChildrenArray( $input_array, diff --git a/tests/class/util/SC_Utils/SC_Utils_sfIsIntTest.php b/tests/class/util/SC_Utils/SC_Utils_sfIsIntTest.php index bcfe5877bc..c72bc4f9f8 100644 --- a/tests/class/util/SC_Utils/SC_Utils_sfIsIntTest.php +++ b/tests/class/util/SC_Utils/SC_Utils_sfIsIntTest.php @@ -93,15 +93,14 @@ public function testSfIsInt正の整数の場合TRUEが返る() } // TODO 「整数かどうか」という関数名なのでここはFALSEになるべきでは? - /** - public function testSfIsInt_正の小数の場合_FALSEが返る() - { - $this->expected = FALSE; - $this->actual = SC_Utils::sfIsInt('123.456'); + // public function testSfIsInt_正の小数の場合_FALSEが返る() + // { + // $this->expected = FALSE; + // $this->actual = SC_Utils::sfIsInt('123.456'); + + // $this->verify('整数かどうか'); + // } - $this->verify('整数かどうか'); - } - */ public function testSfIsInt負の整数の場合TRUEが返る() { $this->expected = true; @@ -111,13 +110,13 @@ public function testSfIsInt負の整数の場合TRUEが返る() } // TODO 文字列長でチェックしているので負の場合は範囲が小さくなっている - /* - public function testSfIsInt_負の整数で桁数が最大の場合_TRUEが返る() - { - $this->expected = TRUE; - $this->actual = SC_Utils::sfIsInt('-123456789'); - - $this->verify('整数かどうか'); - } - */ + /* + public function testSfIsInt_負の整数で桁数が最大の場合_TRUEが返る() + { + $this->expected = TRUE; + $this->actual = SC_Utils::sfIsInt('-123456789'); + + $this->verify('整数かどうか'); + } + */ } diff --git a/tests/class/util/SC_Utils/SC_Utils_sfIsMatchHashPassword_authTypePlainTest.php b/tests/class/util/SC_Utils/SC_Utils_sfIsMatchHashPassword_authTypePlainTest.php index d92c3c694c..63d67685c7 100644 --- a/tests/class/util/SC_Utils/SC_Utils_sfIsMatchHashPassword_authTypePlainTest.php +++ b/tests/class/util/SC_Utils/SC_Utils_sfIsMatchHashPassword_authTypePlainTest.php @@ -47,29 +47,29 @@ protected function tearDown(): void } // /////////////////////////////////////// - /** - public function testSfIsMatchHashPassword_文字列が一致する場合_trueが返る() - { - $pass = 'ec-cube'; - $hashpass = 'ec-cube'; - $this->expected = TRUE; - $this->actual = SC_Utils::sfIsMatchHashPassword($pass, $hashpass); + // public function testSfIsMatchHashPassword_文字列が一致する場合_trueが返る() + // { + // $pass = 'ec-cube'; + // $hashpass = 'ec-cube'; - $this->verify('パスワード文字列比較結果'); - } + // $this->expected = TRUE; + // $this->actual = SC_Utils::sfIsMatchHashPassword($pass, $hashpass); - public function testSfIsMatchHashPassword_文字列が一致しない場合_falseが返る() - { - $pass = 'ec-cube'; - $hashpass = 'EC-cube'; + // $this->verify('パスワード文字列比較結果'); + // } - $this->expected = FALSE; - $this->actual = SC_Utils::sfIsMatchHashPassword($pass, $hashpass); + // public function testSfIsMatchHashPassword_文字列が一致しない場合_falseが返る() + // { + // $pass = 'ec-cube'; + // $hashpass = 'EC-cube'; + + // $this->expected = FALSE; + // $this->actual = SC_Utils::sfIsMatchHashPassword($pass, $hashpass); + + // $this->verify('パスワード文字列比較結果'); + // } - $this->verify('パスワード文字列比較結果'); - } - */ public function testDummyTest() { // Warning が出るため空のテストを作成 diff --git a/tests/class/util/SC_Utils/SC_Utils_sfMakeHiddenArrayTest.php b/tests/class/util/SC_Utils/SC_Utils_sfMakeHiddenArrayTest.php index 27055ae2b2..81061fa6f0 100644 --- a/tests/class/util/SC_Utils/SC_Utils_sfMakeHiddenArrayTest.php +++ b/tests/class/util/SC_Utils/SC_Utils_sfMakeHiddenArrayTest.php @@ -48,27 +48,27 @@ protected function tearDown(): void public function testSfMakeHiddenArray多段配列が1次元配列に変換される() { $input_array = [ - 'vegetable' => '野菜', - 'fruit' => [ - 'apple' => 'りんご', - 'banana' => 'バナナ', - ], - 'drink' => [ - 'alcohol' => [ - 'beer' => 'ビール', - ], - 'water' => '水', - ], - 'rice' => '米', - ]; + 'vegetable' => '野菜', + 'fruit' => [ + 'apple' => 'りんご', + 'banana' => 'バナナ', + ], + 'drink' => [ + 'alcohol' => [ + 'beer' => 'ビール', + ], + 'water' => '水', + ], + 'rice' => '米', + ]; $this->expected = [ - 'vegetable' => '野菜', - 'fruit[apple]' => 'りんご', - 'fruit[banana]' => 'バナナ', - 'drink[alcohol][beer]' => 'ビール', - 'drink[water]' => '水', - 'rice' => '米', - ]; + 'vegetable' => '野菜', + 'fruit[apple]' => 'りんご', + 'fruit[banana]' => 'バナナ', + 'drink[alcohol][beer]' => 'ビール', + 'drink[water]' => '水', + 'rice' => '米', + ]; $this->actual = SC_Utils::sfMakeHiddenArray($input_array); $this->verify(); } diff --git a/tests/class/util/SC_Utils/SC_Utils_sfPrePointTest.php b/tests/class/util/SC_Utils/SC_Utils_sfPrePointTest.php index 2c35b80317..2c55046cf3 100644 --- a/tests/class/util/SC_Utils/SC_Utils_sfPrePointTest.php +++ b/tests/class/util/SC_Utils/SC_Utils_sfPrePointTest.php @@ -90,9 +90,9 @@ public function testSfPrePoint丸め方法の指定がない場合定数で指 { $this->expected = [9, 9]; $this->actual = [ - SC_Utils::sfPrePoint(100, 9.4), - SC_Utils::sfPrePoint(100, 9.5), - ]; + SC_Utils::sfPrePoint(100, 9.4), + SC_Utils::sfPrePoint(100, 9.5), + ]; $this->verify(); } diff --git a/tests/class/util/SC_Utils/SC_Utils_sfPrintRTest.php b/tests/class/util/SC_Utils/SC_Utils_sfPrintRTest.php index 954527915d..4685f59983 100644 --- a/tests/class/util/SC_Utils/SC_Utils_sfPrintRTest.php +++ b/tests/class/util/SC_Utils/SC_Utils_sfPrintRTest.php @@ -45,18 +45,17 @@ protected function tearDown(): void // /////////////////////////////////////// // TODO 環境により出力形式が異なるため、テスト不可(デバッグ用なので、テストしなくてもよさそう) - /** - public function testSfPrintR__指定したオブジェクトの情報が出力される() - { - $output = '