Skip to content

Commit 8267f33

Browse files
author
Slavey Karadzhov
committed
Test Automation on Windows.
Initial work for issue #73.
1 parent cb6cf9d commit 8267f33

File tree

2 files changed

+78
-7
lines changed

2 files changed

+78
-7
lines changed

appveyor.yml

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# appveyor file
2+
# http://www.appveyor.com/docs/appveyor-yml
3+
4+
os: Windows Server 2012 R2
5+
6+
# build version format
7+
version: "{build}-{branch}"
8+
9+
10+
init:
11+
- git config --global core.autocrlf input
12+
13+
# Set a known clone folder
14+
clone_folder: C:\projects\zsclient
15+
16+
matrix:
17+
fast_finish: true
18+
19+
# branches
20+
branches:
21+
only:
22+
- master
23+
24+
skip_tags: true
25+
skip_commits:
26+
message: /\[\s*skip\s+ci\s*\]/ # Ignore messages with [skip ci]
27+
28+
platform: Any CPU
29+
30+
# Install scripts
31+
install:
32+
## Set PHP.
33+
- cinst php
34+
- SET PATH=C:\tools\php\;%PATH%
35+
- cd C:\tools\php
36+
- copy php.ini-production php.ini
37+
- echo date.timezone="Europe/Berlin" >> php.ini
38+
- echo extension_dir=ext >> php.ini
39+
- echo extension=php_openssl.dll >> php.ini
40+
- echo extension=php_curl.dll >> php.ini
41+
- echo output_buffering = Off >> php.ini
42+
- echo default_charset = UTF-8 >> php.ini
43+
44+
- php -v
45+
- where php
46+
47+
# Install PHPUnit phar
48+
- cinst wget
49+
- SET PATH=C:\tools\;%PATH%
50+
- cd C:\projects\zsclient
51+
- wget https://phar.phpunit.de/phpunit.phar --no-check-certificate
52+
53+
## Set Composer.
54+
- cd C:\projects\zsclient
55+
- php -r "readfile('https://getcomposer.org/installer');" | php
56+
- php composer.phar --version
57+
- php composer.phar install --dev --prefer-source
58+
59+
build_script:
60+
- php vendor/fabpot/php-cs-fixer fix -v --dry-run --level=psr2 .
61+
- php phpunit.phar -c module/Client/tests/phpunit.xml
62+
- php bin/zs-client.phar targetFileLocation
63+
- php bin/build-zpk.php
64+
65+
test: off
66+
deploy: off

module/Client/tests/ClientTest/Service/PathInvokableTest.php

+12-7
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,28 @@ class PathInvokableTest extends PHPUnit_Framework_TestCase
1010
* @var PathInvokable
1111
*/
1212
protected $pathService;
13+
protected $isWindows = false;
1314

1415
public function setUp()
1516
{
1617
$this->pathService = new PathInvokable();
18+
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
19+
$this->isWindows = true;
20+
}
1721
}
1822

1923
/**
2024
* Tests to see if the absolute path resolver functions correctly on most systems
2125
*/
2226
public function testGetAbsolute()
2327
{
24-
$this->assertEquals($this->pathService->getAbsolute('/tmp'), '/tmp');
25-
$this->assertEquals($this->pathService->getAbsolute('tmp/a/b'), getcwd().'/tmp/a/b');
26-
27-
$this->pathService->setWindows(true);
28-
//only this test passes on windows, the two above and the other below don't.
29-
$this->assertEquals($this->pathService->getAbsolute('E:\\tmp'), 'E:\\tmp');
30-
$this->assertEquals($this->pathService->getAbsolute('tmp\\'), getcwd().DIRECTORY_SEPARATOR.'tmp\\');
28+
if ($this->isWindows) {
29+
$this->pathService->setWindows(true);
30+
$this->assertEquals($this->pathService->getAbsolute('E:\\tmp'), 'E:\\tmp');
31+
$this->assertEquals($this->pathService->getAbsolute('tmp\\'), getcwd().'\\tmp\\');
32+
} else {
33+
$this->assertEquals($this->pathService->getAbsolute('/tmp'), '/tmp');
34+
$this->assertEquals($this->pathService->getAbsolute('tmp/a/b'), getcwd().'/tmp/a/b');
35+
}
3136
}
3237
}

0 commit comments

Comments
 (0)