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

testArrayFieldChange() public method

Allow basic type field to be replaced by a Document / DocumentSet type.
    public function testArrayFieldChange()
    {
        $doc = new Document();
        $doc->someOtherField = 'someValue';
        $doc->list = 'test';
        $doc->sync();
        $doc->list = new DocumentSet();
        $doc->list['id'] = array('foo' => '!!', 'bar' => '??');
        $data = array('list' => array('id' => array('foo' => '!!', 'bar' => '??')));
        $result = Exporter::get('update', $doc->export());
        $this->assertEqual($data, $result['update']);
        $doc = new Document();
        $doc->someOtherField = 'someValue';
        $doc->list = new Document(array('data' => array('foo' => '!!')));
        $doc->sync();
        $doc->list = new DocumentSet();
        $doc->list['id'] = array('foo' => '!!', 'bar' => '??');
        $result = Exporter::get('update', $doc->export());
        $this->assertEqual($data, $result['update']);
    }