Skip to content

Commit

Permalink
Merge pull request #527 from elifesciences/remove-validatingstoragead…
Browse files Browse the repository at this point in the history
…apter

Remove broken test feature for mocking api-sdk calls to get subjects
  • Loading branch information
scottaubrey authored Oct 22, 2024
2 parents 70d2c55 + 542fdc0 commit f3d3359
Show file tree
Hide file tree
Showing 12 changed files with 3 additions and 290 deletions.
1 change: 0 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
"nyholm/psr7": "^1.1"
},
"require-dev": {
"csa/guzzle-cache-middleware": "^1.0",
"mockery/mockery": "^1.0",
"phpunit/phpunit": "^7.5",
"squizlabs/php_codesniffer": "^3.5",
Expand Down
130 changes: 3 additions & 127 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 0 additions & 13 deletions tests/src/Search/HttpClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,11 @@

trait HttpClient
{
/** @var ValidatingStorageAdapter */
public $storage;
public $httpClient;

final protected function getHttpClient() : \eLife\ApiClient\HttpClient
{
if (null === $this->httpClient) {
$storage = new InMemoryStorageAdapter();
$validator = new JsonMessageValidator(
new PathBasedSchemaFinder(ComposerLocator::getPath('elife/api').'/dist/model'),
new Validator()
);

$this->storage = new ValidatingStorageAdapter($storage, $validator);

$stack = HandlerStack::create();
$stack->push(new MockMiddleware($this->storage, 'replay'));

$this->httpClient = new Guzzle6HttpClient(new Client([
'base_uri' => 'http://api.elifesciences.org',
'handler' => $stack,
Expand Down
68 changes: 0 additions & 68 deletions tests/src/Search/HttpMocks.php

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,12 @@
use PHPUnit\Framework\TestCase;
use eLife\ApiSdk\Model\BlogArticle;
use eLife\Search\Indexer\ModelIndexer\BlogArticleIndexer;
use tests\eLife\Search\HttpMocks;

final class BlogArticleIndexerTest extends TestCase
{
use GetSerializer;
use CallSerializer;
use ModelProvider;
use HttpMocks;

/**
* @var BlogArticleIndexer
Expand All @@ -38,9 +36,6 @@ protected function getModelDefinitions(): array
*/
public function testSerializationSmokeTest(BlogArticle $blogArticle)
{
// Mock the HTTP call that's made for subjects.
$this->mockSubjects();

// Check A to B
$serialized = $this->callSerialize($this->indexer, $blogArticle);
/** @var BlogArticle $deserialized */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,12 @@
use PHPUnit\Framework\TestCase;
use eLife\ApiSdk\Model\Collection;
use eLife\Search\Indexer\ModelIndexer\CollectionIndexer;
use tests\eLife\Search\HttpMocks;

final class CollectionIndexerTest extends TestCase
{
use GetSerializer;
use CallSerializer;
use ModelProvider;
use HttpMocks;

/**
* @var CollectionIndexer
Expand All @@ -37,8 +35,6 @@ protected function getModelDefinitions(): array
*/
public function testSerializationSmokeTest(Collection $collection)
{
// Mock the HTTP call that's made for subjects.
$this->mockSubjects();
// Check A to B
$serialized = $this->callSerialize($this->indexer, $collection);
/** @var Collection $deserialized */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,12 @@
use PHPUnit\Framework\TestCase;
use eLife\ApiSdk\Model\Interview;
use eLife\Search\Indexer\ModelIndexer\InterviewIndexer;
use tests\eLife\Search\HttpMocks;

final class InterviewIndexerTest extends TestCase
{
use GetSerializer;
use CallSerializer;
use ModelProvider;
use HttpMocks;

/**
* @var InterviewIndexer
Expand All @@ -37,8 +35,6 @@ protected function getModelDefinitions(): array
*/
public function testSerializationSmokeTest(Interview $interview)
{
// Mock the HTTP call that's made for subjects.
$this->mockSubjects();
// Check A to B
$serialized = $this->callSerialize($this->indexer, $interview);
/** @var Interview $deserialized */
Expand Down
4 changes: 0 additions & 4 deletions tests/src/Search/Indexer/ModelIndexer/LabsPostIndexerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,12 @@
use PHPUnit\Framework\TestCase;
use eLife\ApiSdk\Model\LabsPost;
use eLife\Search\Indexer\ModelIndexer\LabsPostIndexer;
use tests\eLife\Search\HttpMocks;

final class LabsPostIndexerTest extends TestCase
{
use GetSerializer;
use CallSerializer;
use ModelProvider;
use HttpMocks;

/**
* @var LabsPostIndexer
Expand All @@ -37,8 +35,6 @@ protected function getModelDefinitions(): array
*/
public function testSerializationSmokeTest(LabsPost $labsPost)
{
// Mock the HTTP call that's made for subjects.
$this->mockSubjects();
// Check A to B
$serialized = $this->callSerialize($this->indexer, $labsPost);
/** @var LabsPost $deserialized */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,12 @@
use PHPUnit\Framework\TestCase;
use eLife\ApiSdk\Model\PodcastEpisode;
use eLife\Search\Indexer\ModelIndexer\PodcastEpisodeIndexer;
use tests\eLife\Search\HttpMocks;

final class PodcastEpisodeIndexerTest extends TestCase
{
use GetSerializer;
use CallSerializer;
use ModelProvider;
use HttpMocks;

/**
* @var PodcastEpisodeIndexer
Expand All @@ -37,8 +35,6 @@ protected function getModelDefinitions(): array
*/
public function testSerializationSmokeTest(PodcastEpisode $podcastEpisode)
{
// Mock the HTTP call that's made for subjects.
$this->mockSubjects();
// Check A to B
$serialized = $this->callSerialize($this->indexer, $podcastEpisode);
/** @var PodcastEpisode $deserialized */
Expand Down
Loading

0 comments on commit f3d3359

Please sign in to comment.