Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace Tests\Feature\Analysis;
- use App\Post;
- use Illuminate\Database\Connection;
- use Illuminate\Database\DatabaseManager;
- use Illuminate\Database\Eloquent\Collection;
- use Tests\TestCase;
- use Illuminate\Foundation\Testing\WithoutMiddleware;
- use Illuminate\Foundation\Testing\DatabaseMigrations;
- use Illuminate\Foundation\Testing\DatabaseTransactions;
- use Mockery as m;
- class CountByCategoriesAndPublishedTest extends TestCase
- {
- public function tearDown()
- {
- m::close();
- parent::tearDown();
- }
- /**
- * @test
- * @group analysis
- */
- public function it_should_get_10_counts()
- {
- $expected = 10;
- $connection = m::mock(DatabaseManager::class)->shouldAllowMockingProtectedMethods();
- $this->app->instance(DatabaseManager::class, $connection);
- $connection->shouldReceive('connection')->once()->shouldReceive('makeConnection')->andReturn(true);
- $instance = m::mock(Post::class);
- $this->app->instance(Post::class, $instance);
- $instance->shouldReceive('whereIn')->once()
- ->shouldReceive('whereBetween')->once()
- ->shouldReceive('count')->andReturn(10);
- $response = $this->get(route('analysis.categories.published', [
- '1,2,3',
- '2017-06-23'
- ]));
- // I got error.
- dd($response->getContent());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement