lithium\tests\cases\data\source\mongo_db\ExporterTest::testUpdateFromResourceLoading PHP Method

testUpdateFromResourceLoading() public method

    public function testUpdateFromResourceLoading()
    {
        $result = new MockResult(array('data' => array(array('_id' => '4c8f86167675abfabdbf0300', 'title' => 'bar'), array('_id' => '5c8f86167675abfabdbf0301', 'title' => 'foo'), array('_id' => '6c8f86167675abfabdbf0302', 'title' => 'dib'))));
        $doc = new DocumentSet(array('model' => $this->_model, 'result' => $result));
        $this->assertEmpty(Exporter::get('update', $doc->export()));
        $this->assertEqual('dib', $doc['6c8f86167675abfabdbf0302']->title);
        $doc['6c8f86167675abfabdbf0302']->title = 'bob';
        $this->assertEqual('6c8f86167675abfabdbf0302', $doc['6c8f86167675abfabdbf0302']->_id);
        $this->assertEqual('bob', $doc['6c8f86167675abfabdbf0302']->title);
        $doc['4c8f86167675abfabdbf0300']->title = 'bill';
        $this->assertEqual('4c8f86167675abfabdbf0300', $doc['4c8f86167675abfabdbf0300']->_id);
        $this->assertEqual('bill', $doc['4c8f86167675abfabdbf0300']->title);
        $expected = Exporter::get('update', $doc->export());
        $this->assertNotEmpty(Exporter::get('update', $doc->export()));
        $this->assertCount(2, $expected['update']);
    }