65 $rl->register( $module->getName(), $module );
68 $blobStore->expects( $this->once() )
69 ->method(
'fetchMessage' )
70 ->will( $this->returnValue(
'First' ) );
73 $blob = $blobStore->getBlob( $module,
'en' );
74 $this->assertEquals(
'{"example":"First"}',
$blob,
'Generated blob' );
77 $blobStore->expects( $this->never() )
78 ->method(
'fetchMessage' )
79 ->will( $this->returnValue(
'Second' ) );
82 $blob = $blobStore->getBlob( $module,
'en' );
83 $this->assertEquals(
'{"example":"First"}',
$blob,
'Cache hit' );
89 $rl->register( $module->getName(), $module );
91 $blobStore->expects( $this->once() )
92 ->method(
'fetchMessage' )
93 ->will( $this->returnValue(
'First' ) );
95 $blob = $blobStore->getBlob( $module,
'en' );
96 $this->assertEquals(
'{"example":"First"}',
$blob,
'Generated blob' );
98 $blobStore->updateMessage(
'example' );
102 $rl->register( $module->getName(), $module );
103 $blobStore = $this->
makeBlobStore( [
'fetchMessage' ], $rl );
104 $blobStore->expects( $this->once() )
105 ->method(
'fetchMessage' )
106 ->will( $this->returnValue(
'Second' ) );
108 $blob = $blobStore->getBlob( $module,
'en' );
109 $this->assertEquals(
'{"example":"Second"}',
$blob,
'Updated blob' );
115 $rl->register( $module->getName(), $module );
117 $blobStore = $this->
makeBlobStore( [
'fetchMessage' ], $rl );
118 $blobStore->expects( $this->once() )
119 ->method(
'fetchMessage' )
120 ->will( $this->returnValueMap( [
121 [
'foo',
'en',
'Hello' ],
124 $blob = $blobStore->getBlob( $module,
'en' );
125 $this->assertEquals(
'{"foo":"Hello"}',
$blob,
'Generated blob' );
131 $module = $this->
makeModule( [
'foo',
'bar' ] );
133 $rl->register( $module->getName(), $module );
135 $blobStore = $this->
makeBlobStore( [
'fetchMessage' ], $rl );
136 $blobStore->expects( $this->exactly( 2 ) )
137 ->method(
'fetchMessage' )
138 ->will( $this->returnValueMap( [
139 [
'foo',
'en',
'Hello' ],
140 [
'bar',
'en',
'World' ],
143 $blob = $blobStore->getBlob( $module,
'en' );
144 $this->assertEquals(
'{"foo":"Hello","bar":"World"}',
$blob,
'Updated blob' );
150 $rl->register( $module->getName(), $module );
151 $blobStore = $this->
makeBlobStore( [
'fetchMessage' ], $rl );
152 $blobStore->expects( $this->exactly( 2 ) )
153 ->method(
'fetchMessage' )
154 ->will( $this->onConsecutiveCalls(
'First',
'Second' ) );
156 $blob = $blobStore->getBlob( $module,
'en' );
157 $this->assertEquals(
'{"example":"First"}',
$blob,
'Generated blob' );
159 $blob = $blobStore->getBlob( $module,
'en' );
160 $this->assertEquals(
'{"example":"First"}',
$blob,
'Cache-hit' );
164 $blob = $blobStore->getBlob( $module,
'en' );
165 $this->assertEquals(
'{"example":"Second"}',
$blob,
'Updated blob' );