Skip to content

Commit 79deef2

Browse files
committed
Try fix tests
1 parent 2f84269 commit 79deef2

File tree

3 files changed

+339
-155
lines changed

3 files changed

+339
-155
lines changed

tests/Mock/Output.php

Lines changed: 5 additions & 155 deletions
Original file line numberDiff line numberDiff line change
@@ -9,159 +9,9 @@
99
*/
1010
namespace Phpbb\Epv\Tests\Mock;
1111

12-
13-
use Phpbb\Epv\Files\FileInterface;
14-
use Phpbb\Epv\Output\OutputInterface;
15-
use Symfony\Component\Console\Formatter\OutputFormatterInterface;
16-
17-
class Output implements OutputInterface
18-
{
19-
public $progress = 0;
20-
public $messages = array();
21-
22-
public function write($messages, $newline = false, $type = self::OUTPUT_NORMAL)
23-
{
24-
25-
}
26-
27-
public function writeln($messages, $type = self::OUTPUT_NORMAL)
28-
{
29-
30-
}
31-
32-
public function setVerbosity($level)
33-
{
34-
}
35-
36-
public function getVerbosity(): int
37-
{
38-
}
39-
40-
public function setDecorated($decorated)
41-
{
42-
43-
}
44-
45-
public function isDecorated(): bool
46-
{
47-
48-
}
49-
50-
public function setFormatter(OutputFormatterInterface $formatter)
51-
{
52-
53-
}
54-
55-
/**
56-
* Write a message to the output, but only if Debug is enabled.
57-
*
58-
* @param $message string|array $messages The message as an array of lines of a single string
59-
*
60-
* @throws \InvalidArgumentException When unknown output type is given
61-
*/
62-
public function writelnIfDebug($message)
63-
{
64-
65-
}
66-
67-
/**
68-
* Add a new message to the output of the validator.
69-
*
70-
* @param $type int message type
71-
* @param $message string message
72-
* @param \Phpbb\Epv\Files\FileInterface $file File the error happened in. When provided, this is displayed to the user
73-
*
74-
* @throws \Exception
75-
* @internal param bool $skipError
76-
*
77-
*/
78-
public function addMessage($type, $message, FileInterface $file = null)
79-
{
80-
$this->messages[] = array('type' => $type, 'message' => $message);
81-
82-
if ($type == self::FATAL) {
83-
throw new \Exception($message);
84-
}
85-
}
86-
87-
/**
88-
* Get all messages saved into the message queue.
89-
* @return array Array with messages
90-
*/
91-
public function getMessages()
92-
{
93-
94-
}
95-
96-
/**
97-
* Get the amount of messages that were fatal.
98-
* @return int
99-
*/
100-
public function getFatalCount()
101-
{
102-
103-
}
104-
105-
/**
106-
* Get the count for a type;
107-
*
108-
* @param $type
109-
*
110-
* @return mixed
111-
*/
112-
public function getMessageCount($type)
113-
{
114-
115-
}
116-
117-
public function getFormatter(): OutputFormatterInterface
118-
{
119-
120-
}
121-
122-
/**
123-
* Print the status of this specific test.
124-
*
125-
* @param $result The result for this specific test.
126-
*/
127-
public function printErrorLevel($result = null)
128-
{
129-
130-
}
131-
132-
/**
133-
* Returns whether verbosity is quiet (-q).
134-
*
135-
* @return bool true if verbosity is set to VERBOSITY_QUIET, false otherwise
136-
*/
137-
public function isQuiet(): bool
138-
{
139-
}
140-
141-
/**
142-
* Returns whether verbosity is verbose (-v).
143-
*
144-
* @return bool true if verbosity is set to VERBOSITY_VERBOSE, false otherwise
145-
*/
146-
public function isVerbose(): bool
147-
{
148-
}
149-
150-
/**
151-
* Returns whether verbosity is very verbose (-vv).
152-
*
153-
* @return bool true if verbosity is set to VERBOSITY_VERY_VERBOSE, false otherwise
154-
*/
155-
public function isVeryVerbose(): bool
156-
{
157-
}
158-
159-
/**
160-
* Returns whether verbosity is debug (-vvv).
161-
*
162-
* @return bool true if verbosity is set to VERBOSITY_DEBUG, false otherwise
163-
*/
164-
public function isDebug(): bool
165-
{
166-
}
12+
// Runtime selection of Output implementation based on PHP version
13+
if (PHP_VERSION_ID >= 80000) {
14+
class_alias('\Phpbb\Epv\Tests\Mock\OutputPhp8', '\Phpbb\Epv\Tests\Mock\Output');
15+
} else {
16+
class_alias('\Phpbb\Epv\Tests\Mock\OutputLegacy', '\Phpbb\Epv\Tests\Mock\Output');
16717
}

tests/Mock/OutputLegacy.php

Lines changed: 167 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
<?php
2+
/**
3+
*
4+
* EPV :: The phpBB Forum Extension Pre Validator.
5+
*
6+
* @copyright (c) 2014 phpBB Limited <https://www.phpbb.com>
7+
* @license GNU General Public License, version 2 (GPL-2.0)
8+
*
9+
*/
10+
namespace Phpbb\Epv\Tests\Mock;
11+
12+
13+
use Phpbb\Epv\Files\FileInterface;
14+
use Phpbb\Epv\Output\OutputInterface;
15+
use Symfony\Component\Console\Formatter\OutputFormatterInterface;
16+
17+
class OutputLegacy implements OutputInterface
18+
{
19+
public $progress = 0;
20+
public $messages = array();
21+
22+
public function write($messages, $newline = false, $type = self::OUTPUT_NORMAL)
23+
{
24+
25+
}
26+
27+
public function writeln($messages, $type = self::OUTPUT_NORMAL)
28+
{
29+
30+
}
31+
32+
public function setVerbosity($level)
33+
{
34+
}
35+
36+
public function getVerbosity(): int
37+
{
38+
}
39+
40+
public function setDecorated($decorated)
41+
{
42+
43+
}
44+
45+
public function isDecorated(): bool
46+
{
47+
48+
}
49+
50+
public function setFormatter(OutputFormatterInterface $formatter)
51+
{
52+
53+
}
54+
55+
/**
56+
* Write a message to the output, but only if Debug is enabled.
57+
*
58+
* @param $message string|array $messages The message as an array of lines of a single string
59+
*
60+
* @throws \InvalidArgumentException When unknown output type is given
61+
*/
62+
public function writelnIfDebug($message)
63+
{
64+
65+
}
66+
67+
/**
68+
* Add a new message to the output of the validator.
69+
*
70+
* @param $type int message type
71+
* @param $message string message
72+
* @param \Phpbb\Epv\Files\FileInterface $file File the error happened in. When provided, this is displayed to the user
73+
*
74+
* @throws \Exception
75+
* @internal param bool $skipError
76+
*
77+
*/
78+
public function addMessage($type, $message, FileInterface $file = null)
79+
{
80+
$this->messages[] = array('type' => $type, 'message' => $message);
81+
82+
if ($type == self::FATAL) {
83+
throw new \Exception($message);
84+
}
85+
}
86+
87+
/**
88+
* Get all messages saved into the message queue.
89+
* @return array Array with messages
90+
*/
91+
public function getMessages()
92+
{
93+
94+
}
95+
96+
/**
97+
* Get the amount of messages that were fatal.
98+
* @return int
99+
*/
100+
public function getFatalCount()
101+
{
102+
103+
}
104+
105+
/**
106+
* Get the count for a type;
107+
*
108+
* @param $type
109+
*
110+
* @return mixed
111+
*/
112+
public function getMessageCount($type)
113+
{
114+
115+
}
116+
117+
public function getFormatter(): OutputFormatterInterface
118+
{
119+
120+
}
121+
122+
/**
123+
* Print the status of this specific test.
124+
*
125+
* @param $result The result for this specific test.
126+
*/
127+
public function printErrorLevel($result = null)
128+
{
129+
130+
}
131+
132+
/**
133+
* Returns whether verbosity is quiet (-q).
134+
*
135+
* @return bool true if verbosity is set to VERBOSITY_QUIET, false otherwise
136+
*/
137+
public function isQuiet(): bool
138+
{
139+
}
140+
141+
/**
142+
* Returns whether verbosity is verbose (-v).
143+
*
144+
* @return bool true if verbosity is set to VERBOSITY_VERBOSE, false otherwise
145+
*/
146+
public function isVerbose(): bool
147+
{
148+
}
149+
150+
/**
151+
* Returns whether verbosity is very verbose (-vv).
152+
*
153+
* @return bool true if verbosity is set to VERBOSITY_VERY_VERBOSE, false otherwise
154+
*/
155+
public function isVeryVerbose(): bool
156+
{
157+
}
158+
159+
/**
160+
* Returns whether verbosity is debug (-vvv).
161+
*
162+
* @return bool true if verbosity is set to VERBOSITY_DEBUG, false otherwise
163+
*/
164+
public function isDebug(): bool
165+
{
166+
}
167+
}

0 commit comments

Comments
 (0)