Extends
lithium\test\Unit
Tests that a scope is honored if one is used.
Returns
voidSource
public function testWriteReadWithScope() {
$data = '/postalCode en_US scope0/';
Catalog::write('runtime', 'validation.postalCode', 'en_US', $data, array(
'scope' => 'scope0'
));
$data = '/postalCode en_US scope1/';
Catalog::write('runtime', 'validation.postalCode', 'en_US', $data, array(
'scope' => 'scope1'
));
$result = Catalog::read('runtime', 'validation.postalCode', 'en_US');
$this->assertNull($result);
$result = Catalog::read('runtime', 'validation.postalCode', 'en_US', array(
'scope' => 'scope0'
));
$expected = '/postalCode en_US scope0/';
$this->assertEqual($expected, $result);
$result = Catalog::read('runtime', 'validation.postalCode', 'en_US', array(
'scope' => 'scope1'
));
$expected = '/postalCode en_US scope1/';
$this->assertEqual($expected, $result);
$data = '/postalCode en_US/';
Catalog::write('runtime', 'validation.postalCode', 'en_US', $data);
$result = Catalog::read('runtime', 'validation.postalCode', 'en_US');
$expected = '/postalCode en_US/';
$this->assertEqual($expected, $result);
}