Mocking framework based on Mockito for Java (C) 2011 Hamish Friedlander / SilverStripe. Distributable under the same license as SilverStripe. Example usage: Create the mock $iterator = Phockito.mock('ArrayIterator); Use the mock object - doesn't do anything, functions return null $iterator->append('Test'); $iterator->asort(); Selectively verify execution Phockito::verify($iterator)->append('Test'); 1 is default - can also do 2, 3 for exact numbers, or 1+ for at least one, or 0 for never Phockito::verify($iterator, 1)->asort(); Example stubbing: Create the mock $iterator = Phockito.mock('ArrayIterator); Stub in a value Phockito::when($iterator->offsetGet(0))->return('first'); Prints "first" print_r($iterator->offsetGet(0)); Prints null, because get(999) not stubbed print_r($iterator->offsetGet(999)); Note that several functions are declared as public so that builder classes can access them. Anything starting with an "_" is for internal consumption only
 /**
  * Setup a mock service using Phockito::spy() to mock a basic version of `isAPIAvaiable`
  * @param boolean $available Can change this to account for when API is unavailable
  * @return __phockito_FlickrService_Spy
  */
 public function getMockService($available = true)
 {
     // setup mock
     $spy = Phockito::spy('FlickrService');
     Phockito::when($spy)->isAPIAvailable()->return($available);
     return $spy;
 }
Ejemplo n.º 2
0
 public function testGreetNameReturnsWorldWhenGeneratorIsBlank()
 {
     Phockito::when($this->nameGenerator)->generate()->return("");
     $actual = $this->testObj->greet();
     $expected = "Hello, World";
     Test::assertEqual($expected, $actual);
 }
 public function setUp()
 {
     parent::setUp();
     Config::nest();
     Injector::nest();
     $this->securityWasEnabled = SecurityToken::is_enabled();
     // Check dependencies
     if (!class_exists('Phockito')) {
         $this->skipTest = true;
         return $this->markTestSkipped("These tests need the Phockito module installed to run");
     }
     // Reset config
     Config::inst()->update('SpellController', 'required_permission', 'CMS_ACCESS_CMSMain');
     Config::inst()->remove('SpellController', 'locales');
     Config::inst()->update('SpellController', 'locales', array('en_US', 'en_NZ', 'fr_FR'));
     Config::inst()->update('SpellController', 'enable_security_token', true);
     SecurityToken::enable();
     // Setup mock for testing provider
     $spellChecker = Phockito::mock('SpellProvider');
     Phockito::when($spellChecker)->checkWords('en_NZ', array('collor', 'colour', 'color', 'onee', 'correct'))->return(array('collor', 'color', 'onee'));
     Phockito::when($spellChecker)->checkWords('en_US', array('collor', 'colour', 'color', 'onee', 'correct'))->return(array('collor', 'colour', 'onee'));
     Phockito::when($spellChecker)->getSuggestions('en_NZ', 'collor')->return(array('collar', 'colour'));
     Phockito::when($spellChecker)->getSuggestions('en_US', 'collor')->return(array('collar', 'color'));
     Injector::inst()->registerService($spellChecker, 'SpellProvider');
 }
 /** Test creation of mock class for builtins **/
 function testCanCreateBasicMockClassOfBuiltin()
 {
     $mock = Phockito::mock('SoapClient');
     $this->assertInstanceOf('SoapClient', $mock);
     $this->assertNull($mock->Foo());
     $this->assertNull($mock->Bar());
 }
Ejemplo n.º 5
0
 /**
  * @expectedException RuntimeException
  */
 public function testPostPactFailure()
 {
     $http = Phockito::spy('Pact\\HttpClient');
     Phockito::when($http)->execute()->return(false);
     $mockServiceRequests = new MockServiceRequests($http);
     $pactDetails = ['consumer' => ['name' => 'c'], 'provider' => ['name' => 'p']];
     $mockServiceRequests->postPact($pactDetails, 'http://127.0.0.1');
 }
Ejemplo n.º 6
0
 protected function setUp()
 {
     $this->_metadataProvider = NorthWindMetadata::Create();
     $this->_serviceConfiguration = new ServiceConfiguration($this->_metadataProvider);
     $this->_serviceConfiguration->setEntitySetAccessRule('*', EntitySetRights::ALL);
     $this->mockQueryProvider = \Phockito::mock('POData\\Providers\\Query\\IQueryProvider');
     $this->providersWrapper = new ProvidersWrapper($this->_metadataProvider, $this->mockQueryProvider, $this->_serviceConfiguration, false);
 }
 function testPhockitoIntegration()
 {
     $mock = Phockito::mock('ViewableData');
     Phockito::when($mock)->getField(stringValue())->return('Foo');
     $this->assertEquals($mock->getField(1), null);
     $this->assertEquals($mock->getField('Bar'), 'Foo');
     Phockito::verify($mock)->getField(integerValue());
 }
 function testSpyingCall()
 {
     $spy = Phockito::spy('PhockitoOverloadedCallTest_OverloadedCall');
     $this->assertEquals($spy->Foo(), 'Foo');
     Phockito::when($spy)->Foo()->return(1);
     $this->assertEquals($spy->Foo(), 1);
     Phockito::verify($spy, 2)->Foo();
 }
Ejemplo n.º 9
0
 function testCanResetCallRecordForSpecificMethod()
 {
     $mock = Phockito::mock('PhockitoResetTest_MockMe');
     $mock->Foo();
     $mock->Bar();
     Phockito::verify($mock)->Foo();
     Phockito::verify($mock)->Bar();
     Phockito::reset($mock, 'Foo');
     Phockito::verify($mock, 0)->Foo();
     Phockito::verify($mock)->Bar();
 }
Ejemplo n.º 10
0
 /**
  * Store the method and args we're stubbing
  */
 private function __phockito_setMethod($method, $args)
 {
     $instance = $this->instance;
     $this->method = $method;
     if (!isset(Phockito::$_responses[$instance])) {
         Phockito::$_responses[$instance] = array();
     }
     if (!isset(Phockito::$_responses[$instance][$method])) {
         Phockito::$_responses[$instance][$method] = array();
     }
     $this->i = count(Phockito::$_responses[$instance][$method]);
     foreach (Phockito::$_responses[$instance][$method] as $i => &$matcher) {
         if (Phockito::_arguments_match($this->class, $method, $matcher['args'], $args)) {
             $this->i = $i;
             break;
         }
     }
     Phockito::$_responses[$instance][$method][$this->i] = array('args' => $args, 'steps' => array());
 }
 public function setUp()
 {
     parent::setUp();
     Injector::nest();
     // Check dependencies
     if (!class_exists('Phockito')) {
         $this->skipTest = true;
         return $this->markTestSkipped("These tests need the Phockito module installed to run");
     }
     // Mock link checker
     $checker = Phockito::mock('LinkChecker');
     Phockito::when($checker)->checkLink('http://www.working.com')->return(200);
     Phockito::when($checker)->checkLink('http://www.broken.com/url/thing')->return(404);
     Phockito::when($checker)->checkLink('http://www.broken.com')->return(403);
     Phockito::when($checker)->checkLink('http://www.nodomain.com')->return(0);
     Phockito::when($checker)->checkLink('/internal/link')->return(null);
     Phockito::when($checker)->checkLink('[sitetree_link,id=9999]')->return(null);
     Phockito::when($checker)->checkLink('home')->return(null);
     Phockito::when($checker)->checkLink('broken-internal')->return(null);
     Phockito::when($checker)->checkLink('[sitetree_link,id=1]')->return(null);
     Phockito::when($checker)->checkLink(Hamcrest_Matchers::anything())->return(404);
     Injector::inst()->registerService($checker, 'LinkChecker');
 }
Ejemplo n.º 12
0
 function testCanSpyAndOverrideUndefinedToString()
 {
     $mock = Phockito::spy('PhockitoTostringTest_MockWithoutToString');
     Phockito::when($mock)->__toString()->return('NewReturnValue');
     $this->assertEquals('NewReturnValue', '' . $mock);
 }
Ejemplo n.º 13
0
 function testCanStubTypeHintedMethodsByPassingOnlyMockIntoWhen()
 {
     $mock = Phockito::mock('PhockitoHamcrestTest_MockMe');
     Phockito::when($mock)->Baz(anything())->return('PassMe');
     $this->assertEquals($mock->Baz(new PhockitoHamcrestTest_PassMe()), 'PassMe');
 }
Ejemplo n.º 14
0
 public function mockController()
 {
     $this->controller = Phockito::spy('Kleinbottle\\tests\\fixtures\\json');
     Phockito::when($this->router)->loadController('json')->return($this->controller);
 }
Ejemplo n.º 15
0
 public function testProcessUnknownAbstractExpressionType()
 {
     //Currently the expression parser just ignores expression types it doesn't know
     //TODO: maybe this should throw instead??
     $unknownExpression = \Phockito::mock('POData\\UriProcessor\\QueryProcessor\\ExpressionParser\\Expressions\\AbstractExpression');
     $expressionProcessor = new ExpressionProcessor(new PHPExpressionProvider('$lt'));
     $actual = $expressionProcessor->processExpression($unknownExpression);
     $this->assertNull($actual);
 }
 /**
  * @expectedException PHPUnit_Framework_Error
  * @expectedExceptionCode E_USER_ERROR
  * @expectedExceptionMessage Can't mock non-existent class NotAClass
  */
 function testBridgingInvalidTypeThrowsException()
 {
     $mock = Phockito::mock('PhockitoHamcrestTypeBridgeTest_MockMe');
     Phockito::when($mock->Foo(HamcrestTypeBridge::argOfTypeThat('NotAClass', anInstanceOf('NotAClass'))))->return('PassMe');
 }
 function testCanMockNamespacedClassWithGloballyResolvedTypedArgument()
 {
     $mock = Phockito::mock('\\org\\phockito\\tests\\PhockitoNamespaceTest_HasGloballyResolvedTypedArguments');
     $arg = new \org\phockito\tests\bar\PhockitoNamespaceTest_Type();
     $this->assertNull($mock->Foo($arg));
     Phockito::when($mock->Foo($arg))->return('Bar');
     $this->assertEquals($mock->Foo($arg), 'Bar');
 }
Ejemplo n.º 18
0
    static $_all_classes = '_ALL_CLASSES';
    static function register_double($double, $of, $isDoubleOfInterface = false)
    {
        $_all_classes = self::$_all_classes;
        global ${$_all_classes};
        if (${$_all_classes} && is_array(${$_all_classes}) && !isset(${$_all_classes}['exists'][$double])) {
            // Mark as exists
            ${$_all_classes}['exists'][$double] = $double;
            if ($isDoubleOfInterface) {
                // If we're doubling an interface, mark the double as an implementor
                if (!isset(${$_all_classes}['implementors'][$of])) {
                    ${$_all_classes}['implementors'][$of] = array();
                }
                ${$_all_classes}['implementors'][$of][$double] = $double;
                // And don't have any parents
                ${$_all_classes}['parents'][$double] = array();
            } else {
                // Otherwise parents are same as good twin's parents + good twin itself
                ${$_all_classes}['parents'][$double] = array_merge(${$_all_classes}['parents'][$of], array($of => $of));
                // And see if good twin is marked as implementor of any interfaces - we should be too
                foreach (${$_all_classes}['implementors'] as $interface => $implementors) {
                    if (array_key_exists($of, $implementors)) {
                        ${$_all_classes}['implementors'][$interface][$double] = $double;
                    }
                }
            }
        }
    }
}
Phockito::$type_registrar = 'Phockito::SilverStripe';
 /**
  * Test that running all groups covers the entire range of dataobject IDs
  */
 public function testRunAllGroups()
 {
     $this->createDummyData(120);
     $logger = new SolrReindexTest_RecordingLogger();
     // Test that running all groups covers the complete set of ids
     $state = array('SolrReindexTest_Variant' => '1');
     for ($i = 0; $i < 6; $i++) {
         // See testReindexSegmentsGroups for test that each of these states is invoked during a full reindex
         $this->getHandler()->runGroup($logger, $this->index, $state, 'SolrReindexTest_Item', 6, $i);
     }
     // Count all ids updated
     $ids = array();
     foreach ($logger->filterMessages('Updated ') as $message) {
         $this->assertNotEmpty(preg_match('/^Updated (?<ids>[,\\d]+)/', $message, $matches));
         $ids = array_unique(array_merge($ids, explode(',', $matches['ids'])));
     }
     // Check ids
     $this->assertEquals(120, count($ids));
     Phockito::verify($this->service, 6)->deleteByQuery(anything());
     Phockito::verify($this->service, 1)->deleteByQuery('+(ClassHierarchy:SolrReindexTest_Item) +_query_:"{!frange l=0 u=0}mod(ID, 6)" +(_testvariant:"1")');
     Phockito::verify($this->service, 1)->deleteByQuery('+(ClassHierarchy:SolrReindexTest_Item) +_query_:"{!frange l=1 u=1}mod(ID, 6)" +(_testvariant:"1")');
     Phockito::verify($this->service, 1)->deleteByQuery('+(ClassHierarchy:SolrReindexTest_Item) +_query_:"{!frange l=2 u=2}mod(ID, 6)" +(_testvariant:"1")');
     Phockito::verify($this->service, 1)->deleteByQuery('+(ClassHierarchy:SolrReindexTest_Item) +_query_:"{!frange l=3 u=3}mod(ID, 6)" +(_testvariant:"1")');
     Phockito::verify($this->service, 1)->deleteByQuery('+(ClassHierarchy:SolrReindexTest_Item) +_query_:"{!frange l=4 u=4}mod(ID, 6)" +(_testvariant:"1")');
     Phockito::verify($this->service, 1)->deleteByQuery('+(ClassHierarchy:SolrReindexTest_Item) +_query_:"{!frange l=5 u=5}mod(ID, 6)" +(_testvariant:"1")');
 }
Ejemplo n.º 20
0
 /**
  * @expectedException PHPUnit_Framework_Error
  * @expectedExceptionCode E_USER_ERROR
  */
 function testCannotMockFinalClass()
 {
     Phockito::mock('PhockitoTest_Final');
 }
Ejemplo n.º 21
0
 protected function setUp()
 {
     $this->mockQueryProvider = \Phockito::mock('POData\\Providers\\Query\\IQueryProvider');
 }
                }
            }
            // Register in implementors
            foreach ($this->implementors as $interface => $implementors) {
                $lImplementors = array_map('strtolower', $implementors);
                if (in_array($lDoubled, $lImplementors)) {
                    $this->implementors[$interface][] = $double;
                }
            }
        }
    }
    /**
     * The callback that Phockito will call every time there's a new double created
     *
     * @param string $double - The class name of the new double
     * @param string $of - The class new of the doubled class or interface
     * @param bool $isDoubleOfInterface - True if $of is an interface, False if it's a class
     */
    static function register_double($double, $of, $isDoubleOfInterface = false)
    {
        $manifest = SS_ClassLoader::instance()->getManifest();
        if (!$manifest instanceof PhockitoClassManifestUpdater) {
            $manifest = new PhockitoClassManifestUpdater($manifest);
            SS_ClassLoader::instance()->pushManifest($manifest, true);
        }
        $manifest->addDouble($double, $of, $isDoubleOfInterface);
    }
}
require_once BASE_PATH . '/vendor/hafriedlander/phockito/Phockito.php';
Phockito::$type_registrar = 'PhockitoClassManifestUpdater';
    static function register_double($double, $of, $isDoubleOfInterface = false)
    {
        $_all_classes = self::$_all_classes;
        global ${$_all_classes};
        if (${$_all_classes} && is_array(${$_all_classes}) && !isset(${$_all_classes}['exists'][$double])) {
            // Mark as exists
            ${$_all_classes}['exists'][$double] = $double;
            if ($isDoubleOfInterface) {
                // If we're doubling an interface, mark the double as an implementor
                if (!isset(${$_all_classes}['implementors'][$of])) {
                    ${$_all_classes}['implementors'][$of] = array();
                }
                ${$_all_classes}['implementors'][$of][$double] = $double;
                // And don't have any parents
                ${$_all_classes}['parents'][$double] = array();
            } else {
                // Otherwise parents are same as good twin's parents + good twin itself
                ${$_all_classes}['parents'][$double] = array_merge(${$_all_classes}['parents'][$of], array($of => $of));
                // And see if good twin is marked as implementor of any interfaces - we should be too
                foreach (${$_all_classes}['implementors'] as $interface => $implementors) {
                    if (array_key_exists($of, $implementors)) {
                        ${$_all_classes}['implementors'][$interface][$double] = $double;
                    }
                }
            }
        }
    }
}
require_once BASE_PATH . '/vendor/hafriedlander/phockito/Phockito.php';
Phockito::$type_registrar = 'PhockitoClassGlobalUpdater';
 public function testDelete()
 {
     // Setup mocks
     $serviceMock = $this->getServiceMock();
     self::$index->setService($serviceMock);
     // Delete the live record (not the stage)
     Versioned::reading_stage('Stage');
     Phockito::reset($serviceMock);
     $item = new SearchVariantVersionedTest_Item(array('Title' => 'Too'));
     $item->write();
     $item->publish('Stage', 'Live');
     Versioned::reading_stage('Live');
     $id = $item->ID;
     $item->delete();
     SearchUpdater::flush_dirty_indexes();
     Phockito::verify($serviceMock, 1)->deleteById($this->getExpectedDocumentId($id, 'Live'));
     Phockito::verify($serviceMock, 0)->deleteById($this->getExpectedDocumentId($id, 'Stage'));
     // Delete the stage record
     Versioned::reading_stage('Stage');
     Phockito::reset($serviceMock);
     $item = new SearchVariantVersionedTest_Item(array('Title' => 'Too'));
     $item->write();
     $item->publish('Stage', 'Live');
     $id = $item->ID;
     $item->delete();
     SearchUpdater::flush_dirty_indexes();
     Phockito::verify($serviceMock, 1)->deleteById($this->getExpectedDocumentId($id, 'Stage'));
     Phockito::verify($serviceMock, 0)->deleteById($this->getExpectedDocumentId($id, 'Live'));
 }
Ejemplo n.º 25
0
 public function testActionMethods()
 {
     $this->mockController();
     $response = $this->router->routeRequest('/routing/test/5/tests/custom', 'POST');
     Phockito::verify($this->controller)->custom(anything(), anything());
     Phockito::reset($this->controller);
     $this->assertEquals($response->body(), '{"action":"custom","var":"5","var2":null}');
     $response = $this->router->routeRequest('/routing/nested/5/child/70/tests/custom', 'POST');
     Phockito::verify($this->controller)->custom(anything(), anything());
     $this->assertEquals($response->body(), '{"action":"custom","var":"5","var2":"70"}');
 }
 protected function getServiceSpy()
 {
     $serviceSpy = Phockito::spy('Solr3Service');
     Phockito::when($serviceSpy)->_sendRawPost()->return($this->getFakeRawSolrResponse());
     return $serviceSpy;
 }
Ejemplo n.º 27
0
 /**
  * Test sending a ThreeDSecure Verify Enrolled request and receiving a ThreeDSecure Verify Enrolled response.
  *
  * @expectedException com\realexpayments\remote\sdk\RealexException
  */
 public function testSendThreeDSecureInvalidResponseHash()
 {
     //get sample response XML
     $path = SampleXmlValidationUtils::THREE_D_SECURE_VERIFY_ENROLLED_RESPONSE_XML_PATH;
     $prefix = __DIR__ . '/../../resources';
     $xml = file_get_contents($prefix . $path);
     $fromXMLResponse = new ThreeDSecureResponse();
     $fromXMLResponse = $fromXMLResponse->fromXml($xml);
     // add invalid hash
     $fromXMLResponse->setHash("invalid hash");
     //mock HttpResponse
     /** @var HttpResponse $httpResponseMock */
     $httpResponseMock = Phockito::mock("com\\realexpayments\\remote\\sdk\\http\\HttpResponse");
     \Phockito::when($httpResponseMock->getBody())->return($fromXMLResponse->toXML());
     \Phockito::when($httpResponseMock->getResponseCode())->return(200);
     // create empty request
     $request = new ThreeDSecureRequest();
     $httpConfiguration = new HttpConfiguration();
     $httpConfiguration->addOnlyAllowHttps(false)->addEndpoint("https://epage.payandshop.com/epage-remote.cgi");
     // mock HttpClient instance
     $httpClientMock = Phockito::mock("com\\realexpayments\\remote\\sdk\\http\\HttpClient");
     \Phockito::when($httpClientMock->execute(\Hamcrest_Core_IsAnything::anything(), \Hamcrest_Core_IsAnything::anything()))->return($httpResponseMock);
     // execute and send on client
     $realexClient = new RealexClient(SampleXmlValidationUtils::SECRET, $httpConfiguration, $httpClientMock);
     $realexClient->send($request);
     $this->fail("RealexException should have been thrown before this point.");
 }
 function testImplementsInjectionOfAnInterfaceDouble()
 {
     global $_PSST_ALL_CLASSES;
     $class = Phockito::mock_class('PhockitoSilverStripeTest_Interface');
     $this->assertTrue(array_key_exists($class, $_PSST_ALL_CLASSES['implementors']['PhockitoSilverStripeTest_Interface']));
 }
Ejemplo n.º 29
0
 /**
  * Test sending a message, expecting an exception due to failure response.
  *
  */
 public function testSendMessageFailure404()
 {
     // Dummy and Mock required objects
     $statusCode = 404;
     $this->setExpectedException("com\\realexpayments\\remote\\sdk\\RealexException", "Exception communicating with Realex");
     try {
         $endpoint = 'https://some-test-endpoint';
         $onlyAllowHttps = true;
         $xml = "<element>test response xml</element>";
         $httpResponse = new HttpResponse();
         $httpResponse->setResponseCode($statusCode);
         $httpResponse->setBody($xml);
         /** @var HttpConfiguration $configurationMock */
         $configurationMock = \Phockito::mock("com\\realexpayments\\remote\\sdk\\http\\HttpConfiguration");
         \Phockito::when($configurationMock->getEndPoint())->return($endpoint);
         \Phockito::when($configurationMock->isOnlyAllowHttps())->return($onlyAllowHttps);
         /** @var HttpClient $httpClientMock */
         $httpClientMock = \Phockito::mock("com\\realexpayments\\remote\\sdk\\http\\HttpClient");
         /** @var HttpRequest $anything */
         \Phockito::when($httpClientMock->execute(\Hamcrest_Core_IsAnything::anything(), \Hamcrest_Core_IsAnything::anything()))->return($httpResponse);
         // execute the method
         $response = HttpUtils::sendMessage($xml, $httpClientMock, $configurationMock);
     } catch (RealexException $e) {
         throw $e;
     } catch (Exception $e) {
         $this->fail("Unexpected exception:" . $e->getMessage());
     }
 }
 /**
  * Test that reindex will generate a top top level queued job, and executing this will perform
  * the necessary initialisation of the grouped queued jobs
  */
 public function testReindexSegmentsGroups()
 {
     $this->createDummyData(18);
     // Create pre-existing jobs
     $this->getQueuedJobService()->queueJob(new SolrReindexQueuedJob());
     $this->getQueuedJobService()->queueJob(new SolrReindexGroupQueuedJob());
     $this->getQueuedJobService()->queueJob(new SolrReindexGroupQueuedJob());
     // Initiate re-index
     $logger = new SolrReindexTest_RecordingLogger();
     $this->getHandler()->triggerReindex($logger, 6, 'Solr_Reindex');
     // Old jobs should be cancelled
     $this->assertEquals(1, $logger->countMessages('Cancelled 1 re-index tasks and 2 re-index groups'));
     $this->assertEquals(1, $logger->countMessages('Queued Solr Reindex Job'));
     // Next job should be queue job
     $job = $this->getQueuedJobService()->getNextJob();
     $this->assertInstanceOf('SolrReindexQueuedJob', $job);
     $this->assertEquals(6, $job->getBatchSize());
     // Test that necessary items are created
     $logger->clear();
     $job->setLogger($logger);
     $job->process();
     // Deletes are performed in the main task prior to individual groups being processed
     // 18 records means 3 groups of 6 in each variant (6 total)
     Phockito::verify($this->service, 2)->deleteByQuery(anything());
     $this->assertEquals(1, $logger->countMessages('Beginning init of reindex'));
     $this->assertEquals(6, $logger->countMessages('Queued Solr Reindex Group '));
     $this->assertEquals(3, $logger->countMessages(' of SolrReindexTest_Item in {"SolrReindexTest_Variant":"0"}'));
     $this->assertEquals(3, $logger->countMessages(' of SolrReindexTest_Item in {"SolrReindexTest_Variant":"1"}'));
     $this->assertEquals(1, $logger->countMessages('Completed init of reindex'));
     // Test that invalid classes are removed
     $this->assertNotEmpty($logger->getMessages('Clearing obsolete classes from SolrReindexTest_Index'));
     Phockito::verify($this->service, 1)->deleteByQuery('-(ClassHierarchy:SolrReindexTest_Item)');
     // Test that valid classes in invalid variants are removed
     $this->assertNotEmpty($logger->getMessages('Clearing all records of type SolrReindexTest_Item in the current state: {"SolrReindexTest_Variant":"2"}'));
     Phockito::verify($this->service, 1)->deleteByQuery('+(ClassHierarchy:SolrReindexTest_Item) +(_testvariant:"2")');
 }