Skip to content

Commit

Permalink
updated phpunit, L5.4 test
Browse files Browse the repository at this point in the history
  • Loading branch information
Felix committed May 30, 2017
1 parent 898197f commit fc473f9
Show file tree
Hide file tree
Showing 16 changed files with 107 additions and 50 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
language: php
php:
- 7.0
- 7.1

env:
matrix:
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

All Notable changes to `laravel-stat-search-analytics` will be documented in this file.

## 1.1.2
- Updated PHPUnit
- Laravel Version 5.4 Test
- Updated License file

## 1.1.1
- Fixed wrong implemented date mutators

Expand Down
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# The MIT License (MIT)

Copyright (c) 2016 Felix Schulze <schulzefelix@example.com>
Copyright (c) 2016 Felix Schulze <github@schulze.co>

> Permission is hereby granted, free of charge, to any person obtaining a copy
> of this software and associated documentation files (the "Software"), to deal
Expand Down
8 changes: 3 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,9 @@
"schulzefelix/laravel-data-transfer-object": "^1.0.0"
},
"require-dev": {
"phpunit/phpunit" : "~4.0",
"squizlabs/php_codesniffer": "^2.3",
"orchestra/testbench" : "3.3.x@dev",
"orchestra/database" : "3.3.x@dev",
"mockery/mockery": "^0.9.5"
"phpunit/phpunit" : "^6.1",
"mockery/mockery": "^0.9.5",
"orchestra/testbench" : "~3.4.6"
},
"autoload": {
"psr-4": {
Expand Down
72 changes: 71 additions & 1 deletion tests/Integration/StatServiceProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,78 @@ public function it_will_throw_an_exception_if_no_key_is_set()
{
$this->app['config']->set('laravel-stat-search-analytics.key', '');

$this->setExpectedException(InvalidConfiguration::class);
$this->expectException(InvalidConfiguration::class);

\Stat::projects()->list();
}

/**
* Assert that the session has a given list of values.
*
* @param array $bindings
*
* @return void
*/
public function assertSessionHasAll(array $bindings)
{
// TODO: Implement assertSessionHasAll() method.
}

/**
* Assert that the session has old input.
*
* @return void
*/
public function assertHasOldInput()
{
// TODO: Implement assertHasOldInput() method.
}

/**
* Assert that the session has a given list of values.
*
* @param string|array $key
* @param mixed $value
*
* @return void
*/
public function assertSessionHas($key, $value = null)
{
// TODO: Implement assertSessionHas() method.
}

/**
* Set the session to the given array.
*
* @param array $data
*
* @return void
*/
public function session(array $data)
{
// TODO: Implement session() method.
}

/**
* Assert that the session has errors bound.
*
* @param string|array $bindings
* @param mixed $format
*
* @return void
*/
public function assertSessionHasErrors($bindings = [], $format = null)
{
// TODO: Implement assertSessionHasErrors() method.
}

/**
* Flush all of the current session data.
*
* @return void
*/
public function flushSession()
{
// TODO: Implement flushSession() method.
}
}
12 changes: 2 additions & 10 deletions tests/Unit/BillingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,20 @@

namespace SchulzeFelix\Stat\Tests\Unit;

use Carbon\Carbon;
use GuzzleHttp\Exception\ClientException;
use Illuminate\Support\Collection;
use Mockery;
use PHPUnit_Framework_TestCase;
use SchulzeFelix\Stat\Exceptions\ApiException;
use PHPUnit\Framework\TestCase;
use SchulzeFelix\Stat\Objects\StatBillKeywordType;
use SchulzeFelix\Stat\Objects\StatBillKeywordTypes;
use SchulzeFelix\Stat\Objects\StatBillOptionalServiceType;
use SchulzeFelix\Stat\Objects\StatBillServices;
use SchulzeFelix\Stat\Objects\StatBillSummary;
use SchulzeFelix\Stat\Objects\StatBulkJob;
use SchulzeFelix\Stat\Objects\StatEngineRankDistribution;
use SchulzeFelix\Stat\Objects\StatProject;
use SchulzeFelix\Stat\Objects\StatRankDistribution;
use SchulzeFelix\Stat\Objects\StatSite;
use SchulzeFelix\Stat\Objects\StatSubAccount;
use SchulzeFelix\Stat\Objects\StatTag;
use SchulzeFelix\Stat\Stat;
use SchulzeFelix\Stat\StatClient;

class BillingTest extends PHPUnit_Framework_TestCase
class BillingTest extends TestCase
{
protected $statClient;

Expand Down
13 changes: 6 additions & 7 deletions tests/Unit/BulkTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@
namespace SchulzeFelix\Stat\Tests\Unit;

use Carbon\Carbon;
use GuzzleHttp\Exception\ClientException;
use Illuminate\Support\Collection;
use Mockery;
use PHPUnit_Framework_TestCase;
use PHPUnit\Framework\TestCase;
use SchulzeFelix\Stat\Exceptions\ApiException;
use SchulzeFelix\Stat\Objects\StatBulkJob;
use SchulzeFelix\Stat\Objects\StatEngineRankDistribution;
Expand All @@ -16,7 +15,7 @@
use SchulzeFelix\Stat\Stat;
use SchulzeFelix\Stat\StatClient;

class BulkTest extends PHPUnit_Framework_TestCase
class BulkTest extends TestCase
{
protected $statClient;

Expand Down Expand Up @@ -119,15 +118,15 @@ public function it_can_create_bulk_exports_jobs_for_ranks()
/** @test */
public function it_throw_an_exception_if_i_want_create_a_bulk_job_for_today()
{
$this->setExpectedException(ApiException::class);
$this->expectException(ApiException::class);

$response = $this->stat->bulk()->ranks(Carbon::now());
}

/** @test */
public function it_throw_an_exception_if_i_want_create_a_bulk_job_for_the_future()
{
$this->setExpectedException(ApiException::class);
$this->expectException(ApiException::class);

$response = $this->stat->bulk()->ranks(Carbon::now()->addWeek());
}
Expand Down Expand Up @@ -231,7 +230,7 @@ public function it_can_create_bulk_exports_jobs_for_site_ranking_distributions()
/** @test */
public function it_throw_an_exception_if_i_want_create_a_bulk_job_site_ranking_distributions_for_the_future()
{
$this->setExpectedException(ApiException::class);
$this->expectException(ApiException::class);
$response = $this->stat->bulk()->siteRankingDistributions(Carbon::now()->addMonth());
}

Expand Down Expand Up @@ -259,7 +258,7 @@ public function it_can_create_bulk_exports_jobs_for_tag_ranking_distributions()
/** @test */
public function it_throw_an_exception_if_i_want_create_a_bulk_job_tag_ranking_distributions_for_the_future()
{
$this->setExpectedException(ApiException::class);
$this->expectException(ApiException::class);
$response = $this->stat->bulk()->siteRankingDistributions(Carbon::now()->addDay());
}

Expand Down
4 changes: 2 additions & 2 deletions tests/Unit/KeywordsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
use Carbon\Carbon;
use Illuminate\Support\Collection;
use Mockery;
use PHPUnit_Framework_TestCase;
use PHPUnit\Framework\TestCase;
use SchulzeFelix\Stat\Objects\StatKeyword;
use SchulzeFelix\Stat\Objects\StatKeywordRanking;
use SchulzeFelix\Stat\Objects\StatKeywordStats;
use SchulzeFelix\Stat\Stat;
use SchulzeFelix\Stat\StatClient;

class KeywordsTest extends PHPUnit_Framework_TestCase
class KeywordsTest extends TestCase
{
protected $statClient;

Expand Down
4 changes: 2 additions & 2 deletions tests/Unit/ProjectsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
use Carbon\Carbon;
use Illuminate\Support\Collection;
use Mockery;
use PHPUnit_Framework_TestCase;
use PHPUnit\Framework\TestCase;
use SchulzeFelix\Stat\Objects\StatProject;
use SchulzeFelix\Stat\Stat;
use SchulzeFelix\Stat\StatClient;

class ProjectsTest extends PHPUnit_Framework_TestCase
class ProjectsTest extends TestCase
{
protected $statClient;

Expand Down
6 changes: 2 additions & 4 deletions tests/Unit/RankingsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,15 @@
namespace SchulzeFelix\Stat\Tests\Unit;

use Carbon\Carbon;
use GuzzleHttp\Exception\ClientException;
use Illuminate\Support\Collection;
use Mockery;
use PHPUnit_Framework_TestCase;
use SchulzeFelix\Stat\Exceptions\ApiException;
use PHPUnit\Framework\TestCase;
use SchulzeFelix\Stat\Objects\StatKeywordEngineRanking;
use SchulzeFelix\Stat\Objects\StatKeywordRanking;
use SchulzeFelix\Stat\Stat;
use SchulzeFelix\Stat\StatClient;

class RankingsTest extends PHPUnit_Framework_TestCase
class RankingsTest extends TestCase
{
protected $statClient;

Expand Down
6 changes: 2 additions & 4 deletions tests/Unit/SerpsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,14 @@
namespace SchulzeFelix\Stat\Tests\Unit;

use Carbon\Carbon;
use GuzzleHttp\Exception\ClientException;
use Illuminate\Support\Collection;
use Mockery;
use PHPUnit_Framework_TestCase;
use SchulzeFelix\Stat\Exceptions\ApiException;
use PHPUnit\Framework\TestCase;
use SchulzeFelix\Stat\Objects\StatSerpItem;
use SchulzeFelix\Stat\Stat;
use SchulzeFelix\Stat\StatClient;

class SerpsTest extends PHPUnit_Framework_TestCase
class SerpsTest extends TestCase
{
protected $statClient;

Expand Down
6 changes: 3 additions & 3 deletions tests/Unit/SitesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use Carbon\Carbon;
use Illuminate\Support\Collection;
use Mockery;
use PHPUnit_Framework_TestCase;
use PHPUnit\Framework\TestCase;
use SchulzeFelix\Stat\Exceptions\ApiException;
use SchulzeFelix\Stat\Objects\StatEngineRankDistribution;
use SchulzeFelix\Stat\Objects\StatFrequentDomain;
Expand All @@ -16,7 +16,7 @@
use SchulzeFelix\Stat\Stat;
use SchulzeFelix\Stat\StatClient;

class SitesTest extends PHPUnit_Framework_TestCase
class SitesTest extends TestCase
{
protected $statClient;

Expand Down Expand Up @@ -475,7 +475,7 @@ public function it_should_throw_an_exception_if_the_date_range_is_higher_than_31
'Result' => []
]]);

$this->setExpectedException(ApiException::class);
$this->expectException(ApiException::class);

$this->stat->sites()->rankingDistributions(13, Carbon::createFromDate(2016, 9, 1), Carbon::createFromDate(2016, 10, 5));
}
Expand Down
7 changes: 2 additions & 5 deletions tests/Unit/SubaccountsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,14 @@
namespace SchulzeFelix\Stat\Tests\Unit;

use Carbon\Carbon;
use GuzzleHttp\Exception\ClientException;
use Illuminate\Support\Collection;
use Mockery;
use PHPUnit_Framework_TestCase;
use SchulzeFelix\Stat\Api\StatSubAccounts;
use SchulzeFelix\Stat\Exceptions\ApiException;
use PHPUnit\Framework\TestCase;
use SchulzeFelix\Stat\Objects\StatSubAccount;
use SchulzeFelix\Stat\Stat;
use SchulzeFelix\Stat\StatClient;

class SubaccountsTest extends PHPUnit_Framework_TestCase
class SubaccountsTest extends TestCase
{
protected $statClient;

Expand Down
7 changes: 3 additions & 4 deletions tests/Unit/TagsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@
namespace SchulzeFelix\Stat\Tests\Unit;

use Carbon\Carbon;
use GuzzleHttp\Exception\ClientException;
use Illuminate\Support\Collection;
use Mockery;
use PHPUnit_Framework_TestCase;
use PHPUnit\Framework\TestCase;
use SchulzeFelix\Stat\Exceptions\ApiException;
use SchulzeFelix\Stat\Objects\StatEngineRankDistribution;
use SchulzeFelix\Stat\Objects\StatFrequentDomain;
Expand All @@ -17,7 +16,7 @@
use SchulzeFelix\Stat\Stat;
use SchulzeFelix\Stat\StatClient;

class TagsTest extends PHPUnit_Framework_TestCase
class TagsTest extends TestCase
{
protected $statClient;

Expand Down Expand Up @@ -315,7 +314,7 @@ public function it_should_throw_an_exception_if_the_date_range_is_higher_than_31
'Result' => []
]]);

$this->setExpectedException(ApiException::class);
$this->expectException(ApiException::class);

$response = $this->stat->tags()->rankingDistributions(13, Carbon::createFromDate(2016, 9, 1), Carbon::createFromDate(2016, 10, 5));
}
Expand Down
Loading

0 comments on commit fc473f9

Please sign in to comment.