File tree Expand file tree Collapse file tree 4 files changed +7
-22
lines changed Expand file tree Collapse file tree 4 files changed +7
-22
lines changed Original file line number Diff line number Diff line change @@ -30,12 +30,12 @@ public function getSoarBinary(): string
30
30
31
31
public function setSoarBinary (string $ soarBinary ): self
32
32
{
33
- if (! file_exists ( $ soarBinary )) {
34
- throw new InvalidArgumentException ( " The file [ $ soarBinary] does not exist. " );
35
- }
36
-
37
- if (! is_executable ( $ soarBinary ) ) {
38
- throw new InvalidArgumentException ("The file [ $ soarBinary] is not executable. " );
33
+ if (
34
+ ! is_file ( $ soarBinary)
35
+ // || !file_exists($soarBinary)
36
+ || ! is_executable ( $ soarBinary )
37
+ ) {
38
+ throw new InvalidArgumentException ("The file [ $ soarBinary] does not exist or is not executable. " );
39
39
}
40
40
41
41
$ this ->soarBinary = realpath ($ soarBinary );
Original file line number Diff line number Diff line change 20
20
* @see https://github.com/guanguans/soar-php
21
21
*/
22
22
23
- use Guanguans \SoarPHP \Exceptions \InvalidArgumentException ;
24
23
use Guanguans \SoarPHP \Soar ;
25
24
use Guanguans \SoarPHP \Support \OS ;
26
25
111
110
});
112
111
});
113
112
114
- it ('will throw InvalidArgumentException when sqls is boolean ' , function (): void {
115
- Soar::create ()->scores (true );
116
- })
117
- ->group (__DIR__ , __FILE__ )
118
- ->throws (InvalidArgumentException::class, \gettype (true ))
119
- ->skip ();
120
-
121
113
it ('can get scores ' , function (): void {
122
114
expect (Soar::create ())
123
115
->scores ('select * from users; ' )
Original file line number Diff line number Diff line change 46
46
->skip ('This test is skipped. Because is not supported in github actions. ' );
47
47
48
48
it ('will throw InvalidArgumentException when set invalid binary ' , function (): void {
49
+ Soar::create ()->setSoarBinary ('/ ' );
49
50
Soar::create ()->setSoarBinary ('soar.path ' );
50
51
})
51
52
->group (__DIR__ , __FILE__ )
Original file line number Diff line number Diff line change 18
18
19
19
namespace Guanguans \SoarPHPTests \Concerns ;
20
20
21
- use Guanguans \SoarPHP \Exceptions \InvalidArgumentException ;
22
21
use Guanguans \SoarPHP \Exceptions \ProcessFailedException ;
23
22
use Guanguans \SoarPHP \Soar ;
24
23
use Symfony \Component \Process \Process ;
25
24
26
- it ('will throw InvalidArgumentException when with-options is boolean ' , function (): void {
27
- Soar::create ()->run (true );
28
- })
29
- ->group (__DIR__ , __FILE__ )
30
- ->throws (InvalidArgumentException::class, \gettype (true ))
31
- ->skip ();
32
-
33
25
it ('will throw ProcessFailedException when sqls is invalid sql ' , function (): void {
34
26
Soar::create ()->setOnlySyntaxCheck (true )->setQuery ('invalid sql ' )->run ();
35
27
})
You can’t perform that action at this time.
0 commit comments