diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..d371eb5 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,20 @@ +language: php + +php: + - 7.0 + - 7.1 + - 7.2 + - 7.3 + - nightly + +matrix: + allow_failures: + - php: nightly + +cache: + directories: + - $HOME/.composer/cache + - vendor + +install: + - composer install diff --git a/composer.json b/composer.json index befea90..6a5723b 100644 --- a/composer.json +++ b/composer.json @@ -13,11 +13,14 @@ } ], "require": { - "php": ">=5.3.0" + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.5" }, "autoload": { - "psr-0": { - "Sail": "src/" + "psr-4": { + "Sail\\": "src/Sail/" } } } diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 85133f6..9f75c73 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -3,7 +3,7 @@ - tests/Useragent/ + tests/UserAgent/ diff --git a/tests/UserAgent/UserAgentTest.php b/tests/UserAgent/UserAgentTest.php index 49f13b6..9d43c38 100644 --- a/tests/UserAgent/UserAgentTest.php +++ b/tests/UserAgent/UserAgentTest.php @@ -1,10 +1,13 @@ 'Safari 3.2', 'version' => '3.2', ), - + ); - public function setup(){ + protected function setup() + { $this->ua = new UserAgent(); $this->ua->pushParser(new Simple()); } - - public function testGetUA(){ + + public function testGetUA() + { $ua = $this->useragent['Chrome']; $this->ua->setUA($ua['string']); $this->assertTrue($this->ua->getUA() == $ua['string']); @@ -40,7 +45,8 @@ public function testGetUA(){ $this->assertTrue($this->ua->getUA() == $ua['string']); } - public function testGetBrowser() { + public function testGetBrowser() + { $ua = $this->useragent['Chrome']; $this->ua->setUA($ua['string']); $this->assertTrue($this->ua->getBrowser()['name'] == $ua['browser']); @@ -49,20 +55,21 @@ public function testGetBrowser() { $this->ua->setUA($ua['string']); $this->assertTrue($this->ua->getBrowser()['name'] == $ua['browser']); } - - public function testGetBrowserVersion() { - + + public function testGetBrowserVersion() + { $ua = $this->useragent['Chrome']; $this->ua->setUA($ua['string']); $this->assertTrue($this->ua->getBrowser()['version'] == $ua['version']); $ua = $this->useragent['Safari']; $this->ua->setUA($ua['string']); - + $this->assertTrue($this->ua->getBrowser()['version'] == $ua['version']); } - - public function testGetOS() { + + public function testGetOS() + { $ua = $this->useragent['Chrome']; $this->ua->setUA($ua['string']); $this->assertTrue($this->ua->getOS()['name'] == $ua['os']); @@ -71,5 +78,4 @@ public function testGetOS() { $this->ua->setUA($ua['string']); $this->assertTrue($this->ua->getOS()['name'] == $ua['os']); } - } diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 8e1325f..6c8c4f5 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -1,8 +1,3 @@ add('AppName', __DIR__.'/../src/'); - - +require_once __DIR__ . '/../vendor/autoload.php';