public function testUpdateWithAndMultilang1() { $mockedConfig = $this->getMockedConfig(); $mockedConfig->shouldReceive('get')->with('multilang::prefix')->andReturn('@'); $mockedConfig->shouldReceive('get')->with('multilang::reservedAttribute')->andReturn('__lang_id__'); $wrapper = $this->getWrapper(); $messageBag = $this->getMockedMessageBag(); $validator = $this->getMockedValid(); $mockedConfig->shouldReceive('get')->andReturn('Lang'); $validator->shouldReceive('make')->andReturn(true); $multiLang = new MultiLang(new Picker(new Collection(), new Element(), $mockedConfig), $mockedConfig, $messageBag, $validator, $wrapper, $this->app['cache.store']); $created = new Content($this->nonMultilangPost); $this->assertTrue($created->save()); $this->nonMultilangPost['content@1'] = 'test Content'; $this->assertTrue($multiLang->update($this->nonMultilangPost, $created)); $this->assertEquals(1, count(Content::find(1)->ContentLangs)); // let!s update again. $this->assertTrue($multiLang->update($this->multilangPost, $created)); $this->assertEquals(2, count(Content::find(1)->ContentLangs)); }
public function testFoundedBugOnNullAttributes() { $content = new Content(['enable' => 1, 'visible' => 1, 'alias' => null]); $post = ['__lang_id__' => 1, 'title' => null, 'content' => null]; $this->assertTrue($content->save()); $content->ContentLangs()->create($post); $wrapper = $this->wrapper->createNew($content); $this->assertEquals(null, $wrapper->title); $this->assertEquals(null, $wrapper->title); $this->assertEquals(null, $wrapper->alias); }