Spork\Test\Batch\Strategy\MongoStrategyTest::testBatchJob PHP Метод

testBatchJob() публичный Метод

public testBatchJob ( )
    public function testBatchJob()
    {
        $coll = $this->mongo->spork->widgets;
        $coll->remove();
        $coll->batchInsert(array(array('name' => 'Widget 1'), array('name' => 'Widget 2'), array('name' => 'Widget 3')));
        $this->manager->createBatchJob($coll->find(), new MongoStrategy())->execute(function ($doc) use($coll) {
            $coll->update(array('_id' => $doc['_id']), array('$set' => array('seen' => true)));
        });
        $this->manager->wait();
        foreach ($coll->find() as $doc) {
            $this->assertArrayHasKey('seen', $doc);
        }
    }